【发布时间】:2018-01-07 00:10:32
【问题描述】:
今天我注意到在特定区域中删除了最接近的可用卫星图像缩放级别(它可能会影响其他区域,但我只关注一个肯定受到影响的区域)。两天前有20级,现在只有19级。
MaxZoomService 仍然说这个位置最近的可用缩放是 20。但是当地图处于 19 级时,按 + 缩放按钮不会将缩放增加到 20 级。
当它说可用时,我无法缩放到 20 级是否有原因?
一些理论解释(均未经证实)包括:
- 最近删除了 20 级缩放,但 MaxZoomService 尚未更新并显示旧值
- 20 级在此位置暂时损坏,很快就会恢复(例如,他们可能正在重新处理此级别的图像图块?)
(我不认为自上而下与倾斜的可用深度有混淆,因为两者都锁定在 19 级)。
更新:
- 以前加载的 20 级地图图块仍然存在于旧 URL 中,只是没有在 Javascript API 地图中加载。也许这有助于解释这只是列出可用图像层的服务的一个临时问题?
- 似乎是全球性问题,而不是孤立的地理区域
- 更改为早期版本的 Google Maps Javascript API(例如添加 ?v=3.29)似乎无法解决问题
查看实时示例:https://jsfiddle.net/3qojzt76/
<!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map;
var latlng = {lat: 37.8768101, lng: -122.2813413}
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
mapTypeId: google.maps.MapTypeId.SATELLITE,
tilt: 0,
center: latlng,
zoom: 19
});
var mapZoomService = new google.maps.MaxZoomService()
mapZoomService.getMaxZoomAtLatLng(latlng, function(MaxZoomResult){
if(google.maps.MaxZoomStatus.OK){
alert('map.getZoom(): '+map.getZoom()+', MaxZoomResult.zoom: ' + MaxZoomResult.zoom)
}else{
alert('Error: in google.maps.MaxZoomService().getMaxZoomAtLatLng()')
}
})
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=&callback=initMap"
async defer></script>
</body>
</html>
【问题讨论】:
-
有趣的问题。该文档没有提供太多帮助。 developers.google.com/maps/documentation/javascript/maxzoom
-
我们今天也注意到了这个错误。现在,我将在尝试设置缩放级别后测试缩放级别。
-
我们的环境中正在发生同样的事情。星期五工作正常,星期六的某个时候停止工作。希望他们的内部问题尽快解决?
-
在新墨西哥州、德克萨斯州和俄克拉荷马州(可能是全球性的)各地也遇到过这个问题。以前可以放大到 20+,现在限制为 19。如果有人发现,真的很想解释一下!
标签: google-maps google-maps-api-3