0
votes

I was working with Google Maps Geocoder API for a while, and today I found a abnormal behavior of the server.

This is my url for the request: https://maps.googleapis.com/maps/api/geocode/json?address=starbucks

But I unexpectedly received only 1 result from the response, which was "Starbucks, 11 Clair Rd W, Guelph, ON N1L 0A6, Canada", even I was in the USA.

I already tried with different API_KEY but still got the same result everytime. Did any body suffer the same issue?

1
I think what you want is the Places API Web Service, the Geocoding Service is not designed to search for something.Daniel W.

1 Answers

2
votes

From the google geocoder help files

Geocoding is the process of converting addresses (like "1600 Amphitheatre Parkway, Mountain View, CA") into geographic coordinates (like latitude 37.423021 and longitude -122.083739), which you can use to place markers on a map, or position the map.

In this case, you're using the process a bit differently than how it was designed. You need to provide it with an address or something resembling an address before it returns the lat/long coordinates of a given location.

At the same time, you can reverse geocode and feed it a lat/long and have the api provide you with the businesses at a given location.

From your query, it looks like you're trying to get the location of every starbucks (lat/long) which is more something that you should get off the starbucks website store locator before feeding this into your Geocoder API calls to get lats/longs.