本文介绍了Google Maps API V3 - 只在使用地理编码器时显示空白地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 因此,我有一些使用Google Maps API V3的JavaScript,并使用地理编码器从地址获取坐标并在这些坐标处显示地图。它工作得很好,但之后几天前再次检查,现在不是显示正确的地图,而是显示空白的蓝色地图,并且不允许您放大或缩小地图或移动地图。似乎没有任何JavaScript错误或从谷歌地图返回的错误,所以不知道是什么原因导致这个... 下面是一个问题的例子:点击这里 任何人都有关于什么可能导致这种情况的想法?解决方案您正在使用未记录的属性: var center = results [0] .geometry.location.Xa - 0.0062; var centerCoord = new google.maps.LatLng(center,results [0] .geometry.location.Ya); (geometry.Xa,geometry.Ya) 使用记录属性(geometry.lat(),geometry.lng()) So I have some javascript that uses the google maps API V3 and uses the geocoder to obtain co ordinates from an address and display a map at those coordinates. It was working totally fine, but then I check it again a few days ago, and now instead of showing the proper map, it just shows a blank blue map, and doesnt let you zoom in or out or move the map. There doesnt appear to be any javascript errors or errors returning from google maps, so not really sure what could be causing this...Heres an example of the problem: Click HereAnyone have any ideas on what might be causing this? 解决方案 You are using undocumented properties:var center = results[0].geometry.location.Xa - 0.0062;var centerCoord = new google.maps.LatLng(center, results[0].geometry.location.Ya);(geometry.Xa, geometry.Ya)That is guaranteed to fail at some point when the version of the API changes.Use the documented properties (geometry.lat(), geometry.lng()) 这篇关于Google Maps API V3 - 只在使用地理编码器时显示空白地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-26 05:45