Google API country?

I am using this URL to fetch the location data from Google Map about the city. I am specially interested in a country of that city.

But here is the catch if the city is in USA it will only show US results and omit from other countries.

Toledo is a Spanish city as well as US. This link should return both but instead it only shows US:

How to make it return Spain and US or other country that might have same city???

I had a quick look at the Google API documentation, and funnily enough Toledo is a location that they use as an example.

"In a geocoding response, the Google Maps Geocoding API returns address results influenced by the region (typically the country) from which the request is sent. For example, searches for “San Francisco” may return different results if sent from a domain within the United States than one sent from Spain.

For example, a geocode for “Toledo” returns this result, as the default domain for the Google Maps Geocoding API is set to the United States. Request:"

It does suggest that you can specify the region parameter to the appropriate country-code, but interestingly it doesn’t talk about how to make it return all, unless you use the viewport setting.

"A geocoding request for “Toledo” with region=es (Spain) will return the Spanish city. Request:"

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.