Google Places Autocomplete to return non-abbreviated administrative areas?

StackOverflow https://stackoverflow.com/questions/22676435

  •  22-06-2023
  •  | 
  •  

Вопрос

Running the HTTP request: https://maps.googleapis.com/maps/api/place/autocomplete/json?input=atlanta&types=(cities)&sensor=false&key=<api_key>

returns results that include Atlanta, GA, United States

Is there a way to return results of a query that don't includes abbreviated names? So I could get back Atlanta, Georgia, United States?

Or do I need need to make an additional query with the reference token?

Это было полезно?

Решение

Try using Google Place Details API with the "reference" parameter returned by Google Place Auto Complete. This will return extensive information on your location query, including long and short names.

https://maps.googleapis.com/maps/api/place/details/json?reference=x&key=y&sensor=false

where x is the "reference" from your auto complete query, and y = your API key.

Here is the link for the Details API: https://developers.google.com/places/documentation/details#PlaceDetailsRequests

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top