问题描述
我正在使用谷歌地图来获取城市的自动完成列表.
I'm using google maps to get an autocomplete list of cities.
我曾经使用 item.geometry.location.kb 作为经度,使用 item.geometry.location.jb 作为纬度,但从今天/昨天开始就没有定义.
I used to use item.geometry.location.kb as the longitude and item.geometry.location.jb as the latitude but they are not defined since today/yesterday.
显然,必须使用 item.geometry.location.lng() 和 .lat() 来代替.
Apparently, one has to use item.geometry.location.lng() and .lat() instead.
我不知道,我有一个使用 item.geometry.location.kb & 的应用程序jb 在 google play 和 app store 中.
I didn't know that and I have an app using item.geometry.location.kb & jb in google play and the app store.
所以我的应用程序无法运行了.
So my apps are not working anymore.
关于为什么进行更改以及如何恢复为 kb & 的任何想法jb ?
Any idea on why a change has been made and how to revert to kb & jb ?
谢谢
autocomplete = new google.maps.places.Autocomplete(input, options);
google.maps.event.addListener(autocomplete, 'place_changed', function(event) {
var item = autocomplete.getPlace();
curLon = item.geometry.location.kb;
curLat = item.geometry.location.jb;
...
推荐答案
不要使用 Google API 的未记录属性.他们可以并且确实会随着每个版本的发布而改变.
Don't use undocumented properties of the Google APIs. They can and do change with every release.
geometry.location 是一个 google.maps.LatLng 对象,获取纬度和经度的文档化方法是 .lat() 和 .lng().
geometry.location is a google.maps.LatLng object, the documented methods to get latitude and longitude are .lat() and .lng().
这篇关于item.geometry.location.kb &item.geometry.location.jb 返回未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!