Google Place Autocomplete API返回错误的位置ID [英] Google Place Autocomplete API returning wrong place id

查看:51
本文介绍了Google Place Autocomplete API返回错误的位置ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从今天(或昨天)开始,Google Place Autocomplete网络服务( https://developers .google.com/places/web-service/autocomplete )返回了错误的位置ID(place_id).有谁知道如何从Autocomplete API中获取正确的位置ID?

Since today (or yesterday) the Google Place Autocomplete web service (https://developers.google.com/places/web-service/autocomplete) is returning a wrong place id (place_id). Does anyone know how to get the right place id from the Autocomplete API?

例如,纽约市的地点ID为ChIJOwg_06VPwokRYv534QaPC8g(根据地点详细信息" API),但是自动完成" API返回ChIJOwg_06VPwokRYv534QaPC8iaBilOZXcgWW9yayBDaXR5LCBOZXcgWW9yaywgVmVyZW5pZ2RlIFN0YXRlbg作为place_id.字符串的开头几乎相同,除了正确的"位置ID(g)的最后一个字符.

For example, the place id for New York City is ChIJOwg_06VPwokRYv534QaPC8g (according to the Place Details API), but the Autocomplete API returns ChIJOwg_06VPwokRYv534QaPC8iaBilOZXcgWW9yayBDaXR5LCBOZXcgWW9yaywgVmVyZW5pZ2RlIFN0YXRlbg as place_id. The beginning of the string is almost the same, except for the last character of the 'right' place id (g).

这是一个错误还是Google更改了其地点ID?不幸的是,我找不到与此问题有关的任何东西.

Is this a bug or is Google changing their place ids? Unfortunately I can't find anything related to this problem.

推荐答案

由于最近的问题,Place Autocomplete API中的某些场所ID已更改: https://code.google.com/p/gmaps-api-issues/issues/detail?id=11107 .所有Maps API都应接受较长的位置ID(但请参见 https://code.google.com/p/gmaps-api-issues/issues/detail?id=11107#c30 ).

Some place ids from the Place Autocomplete API have been altered due to a recent issue: https://code.google.com/p/gmaps-api-issues/issues/detail?id=11107. The longer place ids should be accepted by all Maps APIs (but see the caveat in https://code.google.com/p/gmaps-api-issues/issues/detail?id=11107#c30).

不幸的是,这将持续一段时间.获取与长号相对应的短"位置ID的一种方法是发出带有长位置ID的地方详情呼叫(返回的结果将有一个短的地方ID).

Unfortunately, this will be around for some time. A way to get the "short" place id corresponding to a long one is to issue a Place Details call with the long place id (the returned result will have a short place id).

这篇关于Google Place Autocomplete API返回错误的位置ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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