Google place api search result with place_id retur

2019-06-10 07:17发布

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...

2条回答
家丑人穷心不美
2楼-- · 2019-06-10 07:37

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).

查看更多
放荡不羁爱自由
3楼-- · 2019-06-10 07:51

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.

查看更多
登录 后发表回答