I'm using this API call to Google Maps to get the latitude and longitude of a postal code
http://maps.googleapis.com/maps/api/geocode/json?address=2340&sensor=false
The postal code is in Australia. This API call returns locations all around the world with partial matching postal codes in the address.
Is there a parameter I can use to set the country to Australia?
Thanks
Or if you're travelling, and want to see the ZIP Code for your current location, there's a little a little circle button in the upper right corner of the map that will go to your current location and show the ZIP Code.
positionstack - Free Address Geocoding & Maps API.
The Geocoding API uses a pay-as-you-go pricing model. Geocoding API requests generate calls to one of two SKUs depending on the type of request: basic or advanced.
The correct way to do this is not via region biasing but rather using component filtering:
https://maps.google.com/maps/api/geocode/json
?components=country:AU|postal_code:2340
&sensor=false
Some demonstrations:
Please note that if you use the components parameter, you don't need to specify the address parameter.
The documentation says that Region Biasing is based on CcTLDs, which would make Australia au (haven't tried it myself).
Although it also states this:
Note that biasing only prefers results for a specific domain; if more relevant results exist outside of this domain, they may be included.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With