0
使用Google Maps API可以检测卫星图像是否可用,并提供坐标和缩放级别?检测Google卫星图像是否可用
使用Google Maps API可以检测卫星图像是否可用,并提供坐标和缩放级别?检测Google卫星图像是否可用
是的,这是可能的。阅读Google Maps API v3的“最大缩放图像”部分,获取解释和代码示例。
http://code.google.com/apis/maps/documentation/javascript/services.html#MaxZoom
下面是从文档的示例代码,“显示地图上东京都的。点击地图上的任意指示在该位置的最大缩放级别。(东京周围缩放水平通常缩放级别之间变化)“
var map;
var maxZoomService = new google.maps.MaxZoomService();
var tokyo = new google.maps.LatLng(35.6894875, 139.6917064);
function initialize() {
var mapOptions = {
zoom: 11,
center: tokyo,
mapTypeId: google.maps.MapTypeId.HYBRID
}
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
google.maps.event.addListener(map, 'click', showMaxZoom);
}
function showMaxZoom(e) {
maxZoomService.getMaxZoomAtLatLng(e.latLng, function(response) {
if (response.status != google.maps.MaxZoomStatus.OK) {
alert("Error in MaxZoomService");
return;
} else {
alert("The maximum zoom at this location is: " + response.zoom);
}
map.setCenter(e.latLng);
});
}
这个答案对国际读者没有帮助,因为Google提供的翻译文档遗漏了您的代码示例(至少德文版本)。 – Bananeweizen 2011-06-14 18:07:10
@Bananeweizen:不知道它是否会有所帮助,但我编辑了答案以包含相关示例代码。 (对于德语文档不完整,我感到非常惊讶) – Trott 2011-06-14 18:25:06
例如在巴西,最大放大率为19,大城市最大放大倍数为20 .. – B4NZ41 2011-06-14 18:37:53