dannyg_uk


I would like a user to click a button and then capture the users current position and zoom level. Is this possible

Thanks

Danny




Re: Capture position and zoom level

SoulSolutions


Check out the iSDK:

http://dev.live.com/virtualearth/sdk/

You may be interested in GetMapView(); to get the current view rectangle and GetZoomLevel();

John.







Re: Capture position and zoom level

Derek Chan

dannyg_uk wrote:

I would like a user to click a button and then capture the users current position and zoom level. Is this possible

Thanks

Danny


Here's sample code, copy and paste into an html file. Enjoy

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://dev.virtualearth.net/mapcontrol/v4/mapcontrol.js"></script>
<script>
var map = null;

function GetMap()
{
map = new VEMap('myMap');
map.LoadMap();
}

function findcurrentlocation()
{
alert('The top edge of the map on the Web page is at pixel: '+map.GetTop());
alert('The left edge of the map on the Web page is at pixel: '+map.GetLeft());
alert('The latitude,longitude at the center of the map is: '+map.GetCenter());
alert('The current zoom level of the map is: '+map.GetZoomLevel());
alert('The map control version is: '+VEMap.GetVersion());
}
</script>
</head>

<body onload="GetMap();">
<div id='myMap' style="position:relative; width:400px; height:400px;"></div>
<INPUT id="find" type="button" value="Find" name="findcurrentlocation" onclick="findcurrentlocation();">
</body>
</html>