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