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

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

问题描述

从今天(或昨天)起,Google Place 自动完成网络服务 (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_06VPwokRYv534QaPC8iaBilOZXcgWW9yayBOZyaXyRgVidXcgWW9yayBOYZyaXyRgX 地点详情 API 字符串的开头几乎是一样的,除了'正确'的地方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 发出 Place Details 调用(返回的结果将具有短位置 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天全站免登陆