Converts a pixel (a point on the map) to a VELatLong Class object (latitude/longitude pair).
VEMap.PixelToLatLong(pixel);
Parameters
|
Parameter
|
Description
|
|---|
|
pixel
|
A VEPixel Class object representing a pixel location on the map.
|
A VELatLong Class object of the pixel point.
This method may return null values when the map is in 3D mode.
To obtain the bounding area of a map in 3D mode, call the VEMap.GetMapView 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.2"></script>
<script type="text/javascript">
var map = null;
var pixel = null;
var clickEvent = null;
function GetMap()
{
map = new VEMap('myMap');
map.LoadMap();
map.AttachEvent("onclick", PixelClick);
}
function PixelClick(e)
{
var x = e.mapX;
var y = e.mapY;
pixel = new VEPixel(x, y);
var LL = map.PixelToLatLong(pixel);
info.innerHTML = "Pixel X: " + x + " | Pixel Y: " + y + "<br /> LatLong: " + LL;
}
</script>
</head>
<body onload="GetMap();" style="font-family:Arial">
<div id='myMap' style="position:relative; width:400px; height:400px;"></div>
<div id="mapInfo">
Click on the map to display information.<br />
<span id="info"></span>
</div>
</body>
</html>