Pregunta

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?

¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top