Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps API Geocode not returning results on passing postal code as a value to address param

On trying to search a particular address by postal code(2000) it does not return the expected formatted address correctly, but whereas on searching using the address(frederiksberg) instead of postal code it returns the expected formatted address correctly.

https://maps.googleapis.com/maps/api/geocode/json?address=2000&components=country:Denmark&key=apikey

https://maps.googleapis.com/maps/api/geocode/json?address=frederiksberg&components=country:Denmark&key=apikey

But for a similar search with address set to postal code(4000) it returns the expected formatted address correctly, url below.

https://maps.googleapis.com/maps/api/geocode/json?address=4000&components=country:Denmark&key=apikey

Please let us know why its not returning the expected formatted address for address set to 2000.

TIA!

like image 436
Sreekrishnan Avatar asked Apr 26 '18 08:04

Sreekrishnan


1 Answers

We experienced a similar issue with Postcode 2000 in Australia (which is Sydney), returned OK but with Zero_Result returned. All the other postcodes worked fine except 2000

Our initial search was

geocode({ address: "2000 Australia", region: "AU" })

We solving it by adding "Postcode" before the search

geocode({ address: "Postcode 2000 Australia", region: "AU" })

like image 166
camila Avatar answered Oct 21 '22 05:10

camila