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?

asked Aug 4, 2017 at 2:16
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 Commented 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. Commented 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.

Stephen Lead
21.3k18 gold badges117 silver badges245 bronze badges
answered Aug 8, 2017 at 0:29

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.