I have an application that shows the route from one location to another. And I implemented it using Leaflet Routing Machine with OSRM routing engine. Following is a google map image showing some routes,


What I need is I need to get all Zip Codes which fall on that particular Route (Between Two Locations ex. New York to Livingston). I need to get all the Zip Codes in between those two places (in the given route. It may be the alternative route or the main route). And the zip codes can be within a 2-mile radius from the route.

I have downloaded the 2020 ZCTA shapefiles from Census.

2020 ZCTAs: https://www2.census.gov/geo/tiger/TIGER2020/ZCTA520/

I used QGIS to view this shapefile and I saved this to the Postgres database. I need to know how can I get the zip codes which intersect the given route within a 2-mile radius. Basically, the zip codes are in that route.

Here is an example,

From New York, USA to Livingston, New Jersey, USA following are the zip codes fell within a 2-mile radius.

07039, 07052, 07107, 07029, 07306, 10002

Can anybody help me?

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Jul 8 at 12:02


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.