I am using Google Maps Geocoding API to get geometry bounds (northeast, southwest values) of entering the address in store locator address filter.
Example:
When I use to search an address (Postal code, Street name, Landmark) of Singapore with components=country:SG
parameter as like below, it gives only one value in address_components
result set and also this geometry bounds values are not correct for a given address.
https://maps.googleapis.com/maps/api/geocode/json?address=14%20Scotts%20road&components=country:SG
When I use to search an address (Postal code, Street name, Landmark) of Singapore with region=SG
parameter as like below, it gives more than one values in address_components
result set and also this geometry bounds values are correct for a given address.
https://maps.googleapis.com/maps/api/geocode/json?address=14%20Scotts%20road®ion=SG
So here I would like to know the difference and better invoking way between these two methods(region=SG
vs components=country:SG
).
From the documentation:
When you filter on the country, you get the result for the country (in your example the result is for the country of Singapore). If you bias for the region, the returned result prefers results in the country (which it sounds like what you want), but doesn't restrict them to that country and will return a result for an address.