Still related to my last post, today we found another issue with Google Maps. This time, the issue is related to postal code resolution. As you can try yourself, we can enter a postal code in Google Maps, and we will see the correct location appear in the map.
After testing with a few test cases, it seems the result given by Google Maps API is not consistent. For example, examine these three URLs and compare their result:
URL A: Postal Code: 489949
URL B: Postal Code: 529684
URL C: Postal Code: 163009
Result A:
{ "results" : [ { "address_components" : [ { "long_name" : "489949", "short_name" : "489949", "types" : [ "postal_code" ] }, { "long_name" : "Tampines", "short_name" : "Tampines", "types" : [ "neighborhood", "political" ] }, { "long_name" : "Singapore", "short_name" : "Singapore", "types" : [ "locality", "political" ] }, { "long_name" : "Singapore", "short_name" : "SG", "types" : [ "country", "political" ] } ], "formatted_address" : "Singapore 489949", "geometry" : { "location" : { "lat" : 1.334575, "lng" : 103.949792 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 1.335923980291502, "lng" : 103.9511409802915 }, "southwest" : { "lat" : 1.333226019708498, "lng" : 103.9484430197085 } } }, "place_id" : "ChIJh2cj7y892jERKFBGlnIii7Q", "types" : [ "postal_code" ] } ], "status" : "OK" }
Result B:
{ "results" : [ { "address_components" : [ { "long_name" : "529684", "short_name" : "529684", "types" : [ "postal_code" ] }, { "long_name" : "Singapore", "short_name" : "SG", "types" : [ "country", "political" ] } ], "formatted_address" : "51 Tampines Avenue 4, Singapore 529684", "geometry" : { "location" : { "lat" : 1.3527668, "lng" : 103.940085 }, "location_type" : "GEOMETRIC_CENTER", "viewport" : { "northeast" : { "lat" : 1.354115780291502, "lng" : 103.9414339802915 }, "southwest" : { "lat" : 1.351417819708498, "lng" : 103.9387360197085 } } }, "place_id" : "ChIJ2QytGRM92jERrMbjLH1pYVU", "types" : [ "establishment", "point_of_interest" ] } ], "status" : "OK" }
Result C:
{ "results" : [ { "address_components" : [ { "long_name" : "9B", "short_name" : "9B", "types" : [ "street_number" ] }, { "long_name" : "Boon Tiong Road", "short_name" : "Boon Tiong Rd", "types" : [ "route" ] }, { "long_name" : "Singapore", "short_name" : "Singapore", "types" : [ "locality", "political" ] }, { "long_name" : "Singapore", "short_name" : "SG", "types" : [ "country", "political" ] }, { "long_name" : "163009", "short_name" : "163009", "types" : [ "postal_code" ] } ], "formatted_address" : "9B Boon Tiong Road, Tiong Bahru View, Singapore 163009, 9B Boon Tiong Rd, Singapore 163009", "geometry" : { "location" : { "lat" : 1.2868142, "lng" : 103.8289788 }, "location_type" : "ROOFTOP", "viewport" : { "northeast" : { "lat" : 1.288163180291502, "lng" : 103.8303277802915 }, "southwest" : { "lat" : 1.285465219708498, "lng" : 103.8276298197085 } } }, "place_id" : "ChIJEZ_eH3kZ2jER_IcZMYi6gfQ", "types" : [ "establishment", "point_of_interest" ] } ], "status" : "OK" }
So we can see here that we can’t rely on the postal code to get the address. But if we use the lat and long given in the result A, it will actually gives us the correct address 😀
URL A: Lat: 1.334575, Long: 103.949792:
{ "results" : [ { "address_components" : [ { "long_name" : "11", "short_name" : "11", "types" : [ "street_number" ] }, { "long_name" : "Bedok North Avenue 4", "short_name" : "Bedok North Ave 4", "types" : [ "route" ] }, { "long_name" : "Tampines", "short_name" : "Tampines", "types" : [ "neighborhood", "political" ] }, { "long_name" : "Singapore", "short_name" : "Singapore", "types" : [ "locality", "political" ] }, { "long_name" : "Singapore", "short_name" : "SG", "types" : [ "country", "political" ] }, { "long_name" : "489949", "short_name" : "489949", "types" : [ "postal_code" ] } ], "formatted_address" : "11 Bedok North Ave 4, Singapore 489949", "geometry" : { "location" : { "lat" : 1.334575, "lng" : 103.949792 }, "location_type" : "ROOFTOP", "viewport" : { "northeast" : { "lat" : 1.335923980291502, "lng" : 103.9511409802915 }, "southwest" : { "lat" : 1.333226019708498, "lng" : 103.9484430197085 } } }, "place_id" : "ChIJb90H5S892jER41OGX1qDRV0", "types" : [ "street_address" ] }, { "address_components" : [ { "long_name" : "Opp Blk 3011", "short_name" : "Opp Blk 3011", "types" : [ "bus_station", "establishment", "point_of_interest", "transit_station" ] }, { "long_name" : "Tampines", "short_name" : "Tampines", "types" : [ "neighborhood", "political" ] }, { "long_name" : "Singapore", "short_name" : "Singapore", "types" : [ "locality", "political" ] }, { "long_name" : "Singapore", "short_name" : "SG", "types" : [ "country", "political" ] } ], "formatted_address" : "Opp Blk 3011, Singapore", "geometry" : { "location" : { "lat" : 1.3347473, "lng" : 103.9502402 }, "location_type" : "GEOMETRIC_CENTER", "viewport" : { "northeast" : { "lat" : 1.336096280291502, "lng" : 103.9515891802915 }, "southwest" : { "lat" : 1.333398319708498, "lng" : 103.9488912197085 } } }, "place_id" : "ChIJl27l8S892jERJRTu-a5zeOo", "types" : [ "bus_station", "establishment", "point_of_interest", "transit_station" ] }, { "address_components" : [ { "long_name" : "Tampines", "short_name" : "Tampines", "types" : [ "neighborhood", "political" ] }, { "long_name" : "Singapore", "short_name" : "Singapore", "types" : [ "locality", "political" ] }, { "long_name" : "Singapore", "short_name" : "SG", "types" : [ "country", "political" ] } ], "formatted_address" : "Tampines, Singapore", "geometry" : { "bounds" : { "northeast" : { "lat" : 1.375747, "lng" : 103.985835 }, "southwest" : { "lat" : 1.3144619, "lng" : 103.924219 } }, "location" : { "lat" : 1.3495907, "lng" : 103.9567879 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 1.375747, "lng" : 103.985835 }, "southwest" : { "lat" : 1.3144619, "lng" : 103.924219 } } }, "place_id" : "ChIJ0e4CNAQ92jERy_T_mqOSB48", "types" : [ "neighborhood", "political" ] }, { "address_components" : [ { "long_name" : "Singapore", "short_name" : "Singapore", "types" : [ "locality", "political" ] }, { "long_name" : "Singapore", "short_name" : "SG", "types" : [ "country", "political" ] } ], "formatted_address" : "Singapore", "geometry" : { "bounds" : { "northeast" : { "lat" : 1.4708809, "lng" : 104.0415799 }, "southwest" : { "lat" : 1.216611, "lng" : 103.6065099 } }, "location" : { "lat" : 1.3553794, "lng" : 103.8677444 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 1.470624, "lng" : 104.0414138 }, "southwest" : { "lat" : 1.2205143, "lng" : 103.6097687 } } }, "place_id" : "ChIJyY4rtGcX2jERIKTarqz3AAQ", "types" : [ "locality", "political" ] }, { "address_components" : [ { "long_name" : "489949", "short_name" : "489949", "types" : [ "postal_code" ] }, { "long_name" : "Tampines", "short_name" : "Tampines", "types" : [ "neighborhood", "political" ] }, { "long_name" : "Singapore", "short_name" : "Singapore", "types" : [ "locality", "political" ] }, { "long_name" : "Singapore", "short_name" : "SG", "types" : [ "country", "political" ] } ], "formatted_address" : "Singapore 489949", "geometry" : { "location" : { "lat" : 1.334575, "lng" : 103.949792 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 1.335923980291502, "lng" : 103.9511409802915 }, "southwest" : { "lat" : 1.333226019708498, "lng" : 103.9484430197085 } } }, "place_id" : "ChIJh2cj7y892jERKFBGlnIii7Q", "types" : [ "postal_code" ] }, { "address_components" : [ { "long_name" : "489948", "short_name" : "489948", "types" : [ "postal_code" ] }, { "long_name" : "Tampines", "short_name" : "Tampines", "types" : [ "neighborhood", "political" ] }, { "long_name" : "Singapore", "short_name" : "Singapore", "types" : [ "locality", "political" ] }, { "long_name" : "Singapore", "short_name" : "SG", "types" : [ "country", "political" ] } ], "formatted_address" : "Singapore 489948", "geometry" : { "location" : { "lat" : 1.335123, "lng" : 103.949641 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 1.336471980291502, "lng" : 103.9509899802915 }, "southwest" : { "lat" : 1.333774019708498, "lng" : 103.9482920197085 } } }, "place_id" : "ChIJz0_K_i892jERKuoi1XSScek", "types" : [ "postal_code" ] }, { "address_components" : [ { "long_name" : "Singapore", "short_name" : "SG", "types" : [ "country", "political" ] } ], "formatted_address" : "Singapore", "geometry" : { "bounds" : { "northeast" : { "lat" : 1.4784001, "lng" : 104.0945001 }, "southwest" : { "lat" : 1.1496, "lng" : 103.594 } }, "location" : { "lat" : 1.352083, "lng" : 103.819836 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 1.4707592, "lng" : 104.0884808 }, "southwest" : { "lat" : 1.1587023, "lng" : 103.6055575 } } }, "place_id" : "ChIJdZOLiiMR2jERxPWrUs9peIg", "types" : [ "country", "political" ] } ], "status" : "OK" }
I guess we need to find another way to consistently able to resolve postal code. 🙁
loading...
About Hardono
Incoming Search
bugs, google, maps