5

The Google Maps API Geocoding Developers Guide page shows an example of how to geocode an address.

How can I return multiple address suggestions, so that I can pick the correct response?

For example, a search for "Richmond" should return multiple Richmonds across the world. However, this request only returns a single response (when I use a valid API key):

https://maps.googleapis.com/maps/api/geocode/json?address=Richmond&key=YOUR_API_KEY

enter image description here

The example given at https://developers.google.com/maps/documentation/geocoding/intro#RegionCodes even suggests that multiple results should be returned for address=Toledo but I'm still only seeing one result for Toledo.

Is there a parameter to specify the number of results to return?

2
  • @Luke thanks for the tip - in this case I'd argue that the input is definitely 'ambiguous' and it should return multiple results. Adding &components=country:au or &region=au still doesn't help, although there are multiple Richmonds in Australia. Also see my edit regarding the Toledo search, which only returns 1 result for me Aug 4, 2017 at 3:55
  • 1
    Looks like someone asked this on SO and didn't get an answer. The Google Maps API blog suggests you might want to look at the Places API as the Geocoding API is more for complete postal address strings.
    – user2856
    Aug 4, 2017 at 4:30

1 Answer 1

1

Looks like someone asked this on SO and didn't get an answer. The Google Maps API blog says:

The Geocoding API is best for handling unambiguous queries such as complete postal address strings... Geocoding API is not recommended if your application handles ambiguous or incomplete queries

and suggests you might want to look at the Places API as the Geocoding API is more for complete postal address strings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.