Google Geocode API Longitude and Latitude unavailble for zip 96101

前端 未结 2 1614
野趣味
野趣味 2021-01-23 10:19

I am using google geocode api, https://developers.google.com/maps/documentation/geocoding/intro. For zipcode 96101 , it is returning \"No Results Found\".

Although it i

2条回答
  •  轮回少年
    2021-01-23 10:43

    Have you tried using components filtering to search a postal code? When I execute the following request, I get a postal code in the response

    https://maps.googleapis.com/maps/api/geocode/json?components=postal_code%3A96101%7Ccountry%3AUS&key=YOUR_API_KEY

    Also check if API key is correct and billing is enabled in your project. After migration to Google Maps Platform in July 2018 they are mandatory.

    You can also see this result in Geocoder tool:

    https://google-developers.appspot.com/maps/documentation/utils/geocoder/#q%3D%26options%3Dtrue%26in_country%3DUS%26in_postal_code%3D96101

    I hope this helps!

    Update

    There are plenty of similar questions asked in the public issue tracker. For example, this issue:

    https://issuetracker.google.com/issues/77308684

    The answer from Google is the following:

    Submitting a request specifying only postal code or string '11937+US' is an incomplete and ambiguous address that may lead to unexpected results. Per documentation [1]: In the new geocoder, ambiguous, "incomplete and badly formatted queries", such as misspelled or nonexistent addresses, are prone to produce ZERO_RESULTS.

    If your intent is to search postal codes in the USA please use component filters - either using region biasing or country restriction [2]:

    Please also take a look at the Geocoding best practices and FAQs: https://developers.google.com/maps/documentation/geocoding/best-practices https://developers.google.com/maps/faq#geocoder_queryformat

    [1] https://developers.google.com/maps/documentation/geocoding/faq#trbl_zero_results

    [2] https://developers.google.com/maps/documentation/geocoding/intro#ComponentFiltering

提交回复
热议问题