0
votes
  1. https://maps.googleapis.com/maps/api/geocode/json?components=postal_code:01133&sensor=false Expected - return results for country=US, "formatted_address" : "Springfield.."
    Actual - returns results for country=LT, "formatted_address" : "Vilnius 01133, Lithuania"

  2. https://maps.googleapis.com/maps/api/geocode/json?components=postal_code:07477&sensor=false Expected - return results for country=US, "formatted_address" : "Wayne, New Jersey.."
    Actual - NO_RESULTS

What needs to be done to query by US postal code and get US address components in response?

1
And the question is ... ? - MSalters
question is what else needs to be done while querying google geo coder api by US postal code in order to get valid results for US. - Prateek
Well, you're passing postal code 01133 in, and you get a postal code 01133 back. In Lithuania, yes, but they too have postal code 01133. Google doesn't have a crystal ball, how are they supposed to guess that you meant postal code 01133 in the USA ? - MSalters
agreed. Atleast the response can have address components for all matching countries. one for LT and another for US. That is not the case. Moreover passing country:US components filter is no good either. - Prateek

1 Answers

0
votes
  1. I would expect Vilnius AND Sao Paulo because both have 01133 (Postal Codes are NOT unique)
  2. Yeah, that's a Google Problem, because 07470 is the "main" postal code for Wayne, NJ

Check out Postal Codes here:

http://www.geopostcodes.com/index.php

ad 1. Similar Postal Codes for a Springfield I've found (Springfield, MA): 01101, 01103-01105, 01107-01109, 01119, 01128, 01129, 01151 - not 01133