Google Map Places服务会为每个地方返回id和place_id.我可以使用ID来识别位置吗? [英] Google map places service returns both id and place_id for each place. Can I use the id to identify the place?

查看:215
本文介绍了Google Map Places服务会为每个地方返回id和place_id.我可以使用ID来识别位置吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

附近的Google地方信息服务搜索请求返回具有ID和Place_ID的地方.我可以使用ID字段来识别位置吗?旧帖子说id字段已弃用,我应该使用place_id,但在当前文档中找不到该信息.

The Google places service nearbySearch request returns places with both ids and place_ids. Can I use the id field to identify a place? Old posts say that the id field is depreciated, and that I should use the place_id, but I can't find that information in the current documentation.

我要问的原因是place_id有时会发生变化(例如,餐厅地址发生变化),因此它对我来说并不理想.我正在寻找一个识别餐厅的永久性ID.

The reason I'm asking this is the place_id is something that changes from time to time (such as when a restaurant's address changes), so it's not ideal for me to use. I'm looking for a permanent id to identify a restaurant.

我可以使用id字段来做到这一点吗?

Can I use the id field to do this?

推荐答案

Places API结果中的"id"字段已于4年前弃用.作为替换,您将需要使用"place_id"字段向前移动,该字段是唯一标识位置的文本标识符.此文档

The "id" field in Places API result has already been deprecated 4 years ago. In replacement, you'll need to use the "place_id" field moving forward which is the textual identifier that uniquely identifies a place. More info in this doc

在以下Google的公共问题跟踪器中也对此进行了回答: https://issuetracker.google.com /issues/134893143

This has also been answered in Google's Public Issue Tracker here: https://issuetracker.google.com/issues/134893143

尽管place_id是一个地点的唯一标识符,建议使用,但根据

Although the place_id is the unique identifier of a place and is recommended to use, it may change due to certain updates as per this doc. One strategy is to store the original request that returned each place ID. If a place ID becomes invalid, you can re-issue that request to get fresh results.

到目前为止,place_id字段将是对特定位置的最推荐唯一引用.

As of now, the place_id field would be the most recommended unique reference to a specific place.

希望这会有所帮助!

以下是关于弃用的通知,该通知曾经可以在文档中找到.

Below is the deprecation notice that could once be found in the documentation.

注意:idreference字段自2014年6月24日起已弃用.它们由新的场所ID取代,新的场所ID是唯一的标识符,可用于比较场所和检索关于场所的信息.目前,Places API在所有响应中均返回place_id,并在地方详细信息"和地方删除"请求中接受placeid. 2015年6月24日之后不久,API将停止在响应中返回id和reference字段.一段时间后,API将不再接受请求中的引用. 我们建议您更新代码以尽快使用新的地点ID代替ID和参考.

Note: The id and reference fields are deprecated as of June 24, 2014. They are replaced by the new place ID, a unique identifier that can be used to compare places and to retrieve information about a place. The Places API currently returns a place_id in all responses, and accepts a placeid in the Place Details and Place Delete requests. Soon after June 24, 2015, the API will stop returning the id and reference fields in responses. Some time later, the API will no longer accept the reference in requests. We recommend that you update your code to use the new place ID instead of id and reference as soon as possible.

由于某些原因,他们仍然会返回ID字段,但是您绝对应该使用地点ID.

They do still return the ID field for some reason, but you should definitely use the place id instead.

这篇关于Google Map Places服务会为每个地方返回id和place_id.我可以使用ID来识别位置吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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