Why doesnt version 5 of mapcontrol support the ShowDisambiguationDialog method.

Hi,

I am using version 5 of the map control for my desktop application. Based on this sample WinFormsEarthV2 i was able to get started plotting on the maps based on the address entered by the user.

<scriptsrc="http://dev.virtualearth.net/mapcontrol/v5/mapcontrol.js"></script>

Here is the sample code.

<script>

var map;

function OnPageLoad()

{

map =new VEMap('myMap');

map.DisambiguationCallback = disambigCall;

map.ShowDisambiguationDialog(true);

map.ShowMessageBox = false;

map.LoadMap();

}

function disambigCall(e)

{

var results="More than one location was returned. Please select the location you were looking for:<br>";

for (x=0; x<e.length; x++)

{

results+="<a href='javascript:map.Find(\""+e[x].ID+"\");'>"+e[x].ID+"</a><br>";

}

document.getElementById('resultDiv').innerHTML=results;

}

function DoFind(what,where)

{

map.Find(what, where);

}

</script>

But the script never works properly. What exactly is required to get this disambiguation dialog box working. Note that i would like the default dialog box to show the various locations and then allow the user to select the closest city in USA.

Also whether i set this property map.ShowDisambiguationDialog(true); to either true or false (the callback function is also provided) there seems to be no difference in the functioning. As a result i am getting the error dialog box "No results were found". But when searching the websitehttp://maps.live.com, it is able to give a closest match to the street that i enter and spells it out in a new different way. Why is this so and how can i implement the same feature in my desktop application.

Also when using this function

function DoFind(what,where)

{

map.Find(what, where);

}

i hard code the value of where to a particular city of usa for eg

map.Find(parameter1,"New York City"), it may or may not give all the results pertaining to New York City. Can any one tell the right value to use for the where clause for various cities of usa.

finally what is the difference between using these 2 scripts. both do not support the same set of functions.

<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5"></script>

<script src="http://dev.virtualearth.net/mapcontrol/v5/mapcontrol.js"></script>

Thanks.

Rajesh

[4256 byte] By [MVP_M_Rajesh] at [2008-1-9]
# 1

I would start with the code sample for VEMap.ShowDisambiguationDialog:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5"> </script> <script> var map = null; var route = null; var routeType = null; function GetMap() { map = new VEMap('myMap'); map.LoadMap(); } function GetRoute() { if (typeForm.routeType[0].checked) { routeType = VERouteType.Quickest; } else if (typeForm.routeType[1].checked) { routeType = VERouteType.Shortest; } route = map.GetRoute(txtStart.value, txtEnd.value, VEDistanceUnit.Miles, routeType, myCallback()); } function DeleteRoute() { map.DeleteRoute(); } function myCallback() { alert("The callback function has been called."); } function ShowDisambiguationDialog(v) { map.ShowDisambiguationDialog(v); } </script> </head> <body onload="GetMap();" style="font-family:Arial"> <div id='myMap' style="position:relative; width:400px; height:400px;"></div>

Start: <input id="txtStart" type="text" value="Carson" name="txtStart" /> <br /> End: <input id="txtEnd" type="text" value="Area 51" name="txtEnd" />

<form name="typeForm"> Route Type:<br /> <input id="typequickest" type="radio" name="routeType" checked="checked" /> Quickest<br/ > <input id="typeshortest" type="radio" name="routeType" /> Shortest </form> <form id="disamb"> Disambiguation Dialog<br /> <input name="showDisamb" type="radio" onclick="ShowDisambiguationDialog(1)" checked="checked" />Show<br /> <input name="showDisamb" type="radio" onclick="ShowDisambiguationDialog(0)" />Do Not Show </form> <input id="getroute" type="button" value="Get Route" onclick="GetRoute();"/> <input id="deleteroute" type="button" value="Delete Route" onclick="DeleteRoute();"/> </body> </html>
SnoopDoug_98205 at 2007-10-3 > top of Msdn Tech,Windows Live Developer Forums,Virtual Earth: Map Control Development...

Windows Live Developer Forums

Site Classified