'Google maps API does not return postal code for "Chile" based addresses
When I try to get the zipcode for an address using Google maps geocoding API, it works, the postal code is returned as part of the address_components array: (example: https://maps.googleapis.com/maps/api/geocode/json?&address=socoma%201%2C%20marrakesh).
But for Chile (the country) based addresses, it does not seem to return the postal code:(example: https://maps.googleapis.com/maps/api/geocode/json?&address=las%20condes%20santiago%20chile).
Any idea why would be much appreciated.
Solution 1:[1]
I've had a look at information about Las Condes area in wikipedia
https://en.wikipedia.org/wiki/Las_Condes
and figured out that the postal code for Las Condes should be 7550000:
https://worldpostalcode.com/chile/region-metropolitana-de-santiago/santiago/las-condes
Now I try to search the postal code 7550000 in Chile using the components filtering which is the recommended way for postal code lookup
https://maps.googleapis.com/maps/api/geocode/json?components=postal_code%3A7550000%7Ccountry%3ACL&key=MY_API_KEY
This request returns
{
"results":[
],
"status":"ZERO_RESULTS"
}
So, at this point it looks like the postal code 7550000 is missing from the Google database and you are experiencing a data issue. In order to fix data issue you should report it to Google following the document:
https://support.google.com/maps/answer/3094088
Hopefully, Google will add the missing postal code soon.
Solution 2:[2]
Google is not the answer for everything, Chile, and some other countries, has very precise postal codes. Basically for cities, there is a postal code specific for each section of a street. So for Las Condes, the general postal code is 7550000, but if you need the specific code for an address, you need to search on the Chile post web site eg Acapulco street, number 3700 give postal code 7550541. You can also use postal databases like GeoPostcodes
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | xomena |
Solution 2 | PPH |