Search code examples
javascriptnode.jsgoogle-maps-api-3geolocationzipcode

What is a good search for zips by radius API or Node.js Module for the world?


So I am having trouble with this actually. Originally I found a npm module called zip codes. Does exactly what I want in terms of functionality with a little extra, however it only works for the USA. After being disappointed I searched npm and couldn't find anything like it that would include US, Europe, or the rest of the world. So then I figured, well Google should have an api. Well they actually don't.The best I was able to do was get a zip code with lat and long coordinates. I been searching for about a week, and so far I fear that I would have to create a database to do coordinate searching. I'm just hoping that there is another solution than having to do that. But it's possible I been searching the wrong thing. Most of my searches did include zip code lookup or geo zip codes by radius.


Solution

  • You may want to try getting postal_code instead of ZIP code. As differentiated here:

    The two codes are essentially the same in their purpose, but the term Zip code is mainly used in the USA; Postal Code is commonly used in other countries.

    For this, I suggest that you try the given options then see the differences so you may choose what suits your needs.

    You may try the two following processes which Google Maps Geocoding API service provides:

    • Geocoding is the process of converting addresses (like a street address) into geographic coordinates (like latitude and longitude), which you can use to place markers on a map, or position the map.
    • Reverse geocoding is the process of converting geographic coordinates into a human-readable address.

    Requests using these processes possibly returns postal_code You may check Getting Started and this SO post to see sample code implementations or to learn more about Geocoding API service.

    Lastly, for the Node.js, you may want to check these links: