I need to get a unique identifier for the name of a city when that same city is again sought in another language API to find this place same city.
Example:
I do a search via the Google API Autocomplete place like this:
City: New York
The result is:
New York, NY, USA Country code: U.S.
And when I do another search for "New York" in Russian, for example, I need a unique identifier for New York to know that New York is the same in English as in Russian "Нью-Йорк"
The results is:
Нью-Йорк, Нью-Йорк, США Код страны: США
My question is how do I identify that "New York City" is the same in both searches, as I compare the results from the same city in different language and identify the two answers refer to the same New York City?
Consider the following two queries.
Here are few first lines of the response in JSON. As you see there is an
id
available in the result (reference
values are redacted):Now the query for Russian:
This query returns few more predictions (cities with the same name in Missouri, Nebraska, etc.), but still you can find New York City from the Russian results using the
id
:And you can query the Place Details API using the
reference
(which is different for each of the prediction results above):And use
id
to verify the identity of the place you are searching for. Quoting Place Details API documentation:Passing
id
to this query is still possible, butreference
is a required field: