Hi,
I have problems using the Virtual Earth Find function. I am trying to first locate a position using the map.Find() method, and then get the longitude and latitude for that position. The problem is that if I call the map.find wih the first parameter as ' ', the onFindResults function does not get called. Further, a map.getCenter() call right after the map.Find call returns the wrong coordinates. A click on the "locate" button, how ever, returns the correct coordinates. How can a output the correct coordinated without the need for the button Or, how can I get the onFindResults function to be called when the map.Find method is finished
My problem is show in the example below. The alert box show the wrong coordintes the first time, but the correct ones when the button is clicked.
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js"></script>
<script>
var map = null;
function onFindResults(findResults)
{
alert('This is never executed!');
}
function showLocation(){
alert((map.GetCenter()).Latitude+' '+(map.GetCenter()).Longitude);
}
function GetMap()
{
map = new VEMap('myMap');
map.LoadMap();
map.Find('','33330, United States','1',onFindResults);
showLocation();
}
</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:400px; height:400px;"></div>
<input type="button" onclick="showLocation()" value="locate">
</body>
</html>

map.Find and longitude/latitude problems
Saad Ahmed
try:
map.Find('elvis','Las Vegas, NV','1',onFindResults);
and it will work fine. Search the forums for the what and where threads, i think there is a work around and I know the VE team are looking to fix it.
John.