VEMap.PanToLatLong Method
Bing Services
Pans the map to a specific latitude and longitude.
VEMap.PanToLatLong(VELatLong);
Parameters
| Parameter | Description |
|---|---|
VELatLong | A VELatLong Class object that represents the latitude and longitude of the point on which to center the map |
The PanToLatLong method moves the map from one location to another with a smooth transition effect. If you want the map to instantly reposition on a new center point, use the VEMap.SetCenter Method.
<!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 type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script> <script type="text/javascript"> var map = null; function GetMap() { map = new VEMap('myMap'); map.LoadMap(); map.SetZoomLevel(9); } function PanXY() { if ((document.getElementById('txtX').value != "" && document.getElementById('txtY').value != "") && (!isNaN(document.getElementById('txtX').value) && !isNaN(document.getElementById('txtY').value))) { map.Pan(document.getElementById('txtX').value, document.getElementById('txtY').value); } else { alert("Please enter a valid numeric value."); } } function PanLL() { if ((document.getElementById('txtLat').value != "" && document.getElementById('txtLong').value != "") && (!isNaN(document.getElementById('txtLat').value) && !isNaN(document.getElementById('txtLong').value))) { var latLong = new VELatLong(document.getElementById('txtLat').value, document.getElementById('txtLong').value); map.PanToLatLong(latLong); } else { alert("Please enter a valid Latitude or Longitude value."); } } </script> </head> <body onload="GetMap();" style="font-family: Arial"> <div id='myMap' style="position: relative; width: 400px; height: 400px;"> </div> Pixels X: <input id="txtX" style="width: 50px" value="100" /> | Pixels Y: <input id="txtY" style="width: 50px" value="100" /> <input id="btnPanXY" type="button" value="Pan to X/Y" name="btnPanXY" onclick="PanXY()" /> <br /> Lat: <input id="txtLat" value="41.677014822032184" /> | Long: <input id="txtLong" value="-83.5400390625" /> <input id="btnPanLL" type="button" value="Pan to Lat/Long" name="btnPanLL" onclick="PanLL()" /> </body> </html>