Google Maps API V3 - 只在使用地理编码器时显示空白地图 [英] Google Maps API V3 - only showing a blank map when using the geocoder
问题描述
下面是一个问题的例子:< a href =http://vietnamenus.com/restaurants/4P%27s-Pizza =nofollow>点击这里
任何人都有关于什么可能导致这种情况的想法?
您正在使用未记录的属性:
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 Here
Anyone 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 - 只在使用地理编码器时显示空白地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!