我想让这些地方的图像符合这里的介绍:
https://developers.google.com/places/documentation/details#PlaceDetailsRequests
根据这份文件,我需要"地址id"这个地方。
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJN1t_tDeuEmsRUsoyG83frY4&key=AddYourOwnKeyHere
我在哪里可以找到placeid
答案 0 :(得分:9)
您应该可以在此处找到地点ID: https://developers.google.com/places/place-id#find-id
答案 1 :(得分:8)
place_id位于SearchResults的任何SearchRequests中:
{
"html_attributions" : [],
"results" : [
{
"geometry" : {
"location" : {
"lat" : -33.870775,
"lng" : 151.199025
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/travel_agent-71.png",
"id" : "21a0b251c9b8392186142c798263e289fe45b4aa",
"name" : "Rhythmboat Cruises",
"opening_hours" : {
"open_now" : true
},
"photos" : [
{
"height" : 270,
"html_attributions" : [],
"photo_reference" : "CnRnAAAAF-LjFR1ZV93eawe1cU_3QNMCNmaGkowY7CnOf-kcNmPhNnPEG9W979jOuJJ1sGr75rhD5hqKzjD8vbMbSsRnq_Ni3ZIGfY6hKWmsOf3qHKJInkm4h55lzvLAXJVc-Rr4kI9O1tmIblblUpg2oqoq8RIQRMQJhFsTr5s9haxQ07EQHxoUO0ICubVFGYfJiMUPor1GnIWb5i8",
"width" : 519
}
],
"place_id" : "ChIJyWEHuEmuEmsRm9hTkapTCrk", // <----------------------------------------------
"scope" : "GOOGLE",
"alt_ids" : [
{
"place_id" : "D9iJyWEHuEmuEmsRm9hTkapTCrk",
"scope" : "APP"
}
],
答案 2 :(得分:3)
上述解决方案在大多数情况下都有效,但有时候某些人使用与商家相同的地址时,有时会失败。如果您已经用尽了Google文档Here或here
中提供的API和手动搜索的选项您可以使用此页面提供的手册建议,该建议一直对我有用https://www.launch2success.com/guide/cant-find-google-places-id-trick-finding-google-places-id/
答案 3 :(得分:1)
通过搜索地名,您可能需要地方ID Text search。
您的样品申请可能如下
https://maps.googleapis.com/maps/api/place/textsearch/json?query=fish+market+sydney&key=&#34; YOUR_API_KEY&#34;
你会找到&#34; place_id&#34;在返回JSON字符串。