Google place api search result with place_id returns different location with place_id

 ̄綄美尐妖づ 提交于 2019-12-23 04:45:16

问题


I'm using google places api, but it returns the value with different place_id. I have considered this blog : https://developers.google.com/places/documentation/search

I have requested with place id like this : https://maps.googleapis.com/maps/api/place/details/json?key=AAIS...

In this url, you can see that the place_id is "EiJ..."

But in the returning json, i have received different place_id.

"place_id" : "AASS...", "reference" : "df..."

When I have tried with reference, it was the same.

What did I wrong? Is this the same location with different place_id?

Thanks for your help...


回答1:


1) Never post your API key on a public forum. Go get yourself a new one. 2) reference has been deprecated, so you don't need to include it 3) EiJG... doesn't look like a Placeid. My guess is that you are trying to look up a value that doesn't exist and you're getting strange behavior.

Run a Place Search and get the Placeid and try again. You haven't posted what you searched for initially so it's impossible to verify that EiJ... really is a valid Placeid.




回答2:


You can also have more than one place ID associated with a particular place.

In that case, if you request details using one place ID, you can get another ID back (you used the alternate ID, it returns what it considers the primary).

I found your question how to deal with this because I'll be storing information using their primary key and if it changes it will cause issues since the ID initially comes from their search (I'll get the new ID and not realize it is associated with the information I stored).



来源:https://stackoverflow.com/questions/26840556/google-place-api-search-result-with-place-id-returns-different-location-with-pla

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!