After I map an address, how can I find out what the maximum zoom level is available (that is, the maximum I can zoom into without the "missing tiles")
Thanks!
After I map an address, how can I find out what the maximum zoom level is available (that is, the maximum I can zoom into without the "missing tiles")
Thanks!
That's a tough one, ideally we need the VE API to tell us but currently it doesn't.
I have played with trying to detect the tile image itself with mixed results, i wouldn't use it in a commercial site but if you're interested:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/v4/mapcontrol.js"></script>
<script type="text/javascript">
var map = null;
var VEnoimagesize = -1;
var VETilePath = "tiles.virtualearth";
function GetMap()
{
map = new VEMap('myMap');
map.LoadMap(new VELatLong(-27.5, 137), 4 ,'h' ,false);
map.AttachEvent("onchangeview", CheckZoomLevel);
}
function CheckZoomLevel()
{
setTimeout("DelayedCheckZoomLevel()",1000);
}
function DelayedCheckZoomLevel()
{
if (map.GetMapStyle() != VEMapStyle.Road)
{
var y = document.images;
var imglength = 0;
for (i=0;i<y.length;i++)
{
if (y[ i].fileSize==VEnoimagesize && y[ i].src.indexOf(VETilePath) > 0)
{
//Change to Road view
map.SetMapStyle(VEMapStyle.Road);
//Or you could zoom out
//map.SetZoomLevel(13);
break;
}
}
}
}
</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:400px; height:400px;"></div>
</body>
</html>
John.
Derek,
But level 19 is not available in all areas. After I map an address, I need to zoom to the highest level available for _that area_, which may not be level 19.
Dave
Yeah that works for road view but what people are really looking for is for aerial and hybrid mode. You should get zoomlevel 13 for most of the world, better in cities.
John.