gpt4 book ai didi

android - 谷歌地方 API : Are "place_id" or "id" unique to any city in the world?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:28:40 24 4
gpt4 key购买 nike

在为位置执行自动完成 API 调用时,我请求来自 google 的 JSON 响应。

“id”和“place_id”字符串有什么区别?

这两个 ID 是世界上任何一个城市唯一的吗?

Google places 会为世界上的每个城市分配一个 ID 吗?

例如,Somers, NY, USA 是否与 Somers, New York, United States 具有相同的 id?

有没有一种简单的方法可以获取城市的 ID? (来自谷歌地图网址或其他?)

这是美国纽约州 Somers 的自动完成 API 调用的 JSON 响应:

    {
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "Somers",
"short_name" : "Somers",
"types" : [ "administrative_area_level_3", "political" ]
},
{
"long_name" : "Westchester County",
"short_name" : "Westchester County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "New York",
"short_name" : "NY",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
}
],
"adr_address" : "\u003cspan class=\"locality\"\u003eSomers\u003c/span\u003e, \u003cspan class=\"region\"\u003eNY\u003c/span\u003e, \u003cspan class=\"country-name\"\u003eUSA\u003c/span\u003e",
"formatted_address" : "Somers, NY, USA",
"geometry" : {
"location" : {
"lat" : 41.29963050000001,
"lng" : -73.7360175
},
"viewport" : {
"northeast" : {
"lat" : 41.3550988,
"lng" : -73.65881709999999
},
"southwest" : {
"lat" : 41.2379047,
"lng" : -73.78000709999999
}
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png",
"id" : "8e846f7cdf419380d138e6d605137e739075b777",
"name" : "Somers",
"place_id" : "ChIJ6wv7yGixwokRIwjh6OWI4I0",
"reference" : "CoQBcgAAAKxvwwjlyK3ZaVA5DAM52DU8tMMplyvamYxXVJuMyDplQ3SUs-9ONvZgIN4sDW_sUz9z7wdoBCmPcgWHY9Oi_l0hImvMtiE8s6TKaUCDju2vzlcSEGXtDW0bvixVbbuF35AP2stRw80YjcrnwuMDglKEHKUVdH8vzSVG91WNOcOcEhBda300E-VstT6ZQ1zCx30eGhQBUGcFLuUeB484h1AzDw75Aw5wxA",
"scope" : "GOOGLE",
"types" : [ "administrative_area_level_3", "political" ],
"url" : "https://maps.google.com/maps/place?q=Somers,+NY,+USA&ftid=0x89c2b168c8fb0beb:0x8de088e5e8e10823"
},
"status" : "OK"
}

最佳答案

“id”和“reference”已被弃用,并将于 2015 年年中从结果中删除。从您可以从该信息的某个地方查找的意义上说,它们并不是“独特的”。

Placeid 是不同的 - 它对于位置来说都是唯一的,而且位置通常只有一个 Placeid。 (在大多数情况下都是如此。但是,“地点”可以有其他 ID,这些 ID 指的是不同的范围(Google 范围与用户范围),或者如果企业已搬到不同的地方,则为其提供新的 place_id。但是在所有情况下, place_id 仍然存在。)此外,您使用 Placeid 访问详细信息 API。

在此处查看弃用通知:https://developers.google.com/places/documentation/search

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.

关于android - 谷歌地方 API : Are "place_id" or "id" unique to any city in the world?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27198283/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com