Google地图 - 奇怪的geometry.location属性(G,K) [英] Google maps - Weird geometry.location attributes (G, K)

查看:141
本文介绍了Google地图 - 奇怪的geometry.location属性(G,K)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我访问Places API时,Google会发送一个包含以下两个属性的对象:

 位置.geometry.G 
location.geometry.K

这些代表纬度和经度。我从来没有在任何地方读过这些。此外,我所有的代码库最近变得不稳定,因为它最近改变了字母H& L.



这很奇怪,不是吗?我错过了什么?

解决方案

这些是API的非文档属性(特定google.maps.LatLng的纬度和经度通过使用记录的方法( .lat())来可靠地访问它们。

.lng()


When I access the Places API, Google sends back an object with, among other things, these two properties :

location.geometry.G
location.geometry.K

These represent the latitude and longitudes. I never read about these anywhere. Besides, all my codebase recently became unstable because it recently changed for the letters H & L.

This is weird, isn't it ? What did I miss ?

解决方案

Those are undocumented properties of the API (the latitude and longitude of that particular google.maps.LatLng object)

Access them reliably by using the documented methods (.lat(), .lng())

这篇关于Google地图 - 奇怪的geometry.location属性(G,K)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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