Google Maps API V3 - 使用地理编码器时仅显示空白地图 [英] Google Maps API V3 - only showing a blank map when using the geocoder

查看:24
本文介绍了Google Maps API V3 - 使用地理编码器时仅显示空白地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一些 javascript 使用谷歌地图 API V3 并使用地理编码器从地址获取坐标并在这些坐标处显示地图.它工作正常,但几天前我再次检查它,现在不是显示正确的地图,而是显示一张空白的蓝色地图,并且不允许您放大或缩小或移动地图.似乎没有任何 javascript 错误或从谷歌地图返回的错误,所以不确定是什么导致了这个......

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)

(geometry.Xa, geometry.Ya)

当 API 版本发生变化时,这肯定会在某些时候失败.

That is guaranteed to fail at some point when the version of the API changes.

使用记录的属性(geometry.lat()、geometry.lng())

这篇关于Google Maps API V3 - 使用地理编码器时仅显示空白地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆