[GIS] Query Overpass Turbo for postal code boundaries

openstreetmapoverpass-api

I'm looking to query Overpass Turbo for postal code boundaries, specifically all within the USA. Here's what I found so far and where I'm stymied:

This query for postal code boundaries in Liepzig works:

area[name="Leipzig"][admin_level=6][boundary=administrative]->.myarea;
rel(area.myarea)["boundary"="postal_code"];
out geom;

This query for boundaries of the State of Oregon works:

area[name="Oregon"][admin_level=4][boundary=administrative]->.myarea;
rel(pivot.myarea);
out geom;

But this query for postal code boundaries inside the State of Oregon does not:

area[name="Oregon"][admin_level=4][boundary=administrative]->.myarea;
rel(area.myarea)["boundary"="postal_code"];
out geom;

Thoughts on why this last query doesn't work while the first two do?

Best Answer

You can only get out of Openstreetmap what others have put into the database.

If you look at https://taginfo.openstreetmap.org/tags/boundary=postal_code#map, you will see that boundaries of type postal_code are mostly used in Germany, but only few outside.

Address information is mainly stored using the key addr:postcode, as you see at https://taginfo.openstreetmap.org/keys/addr:postcode#map, as well as the key postal_code https://taginfo.openstreetmap.org/keys/postal_code#map. So you have to query for those, and build boundary polygons from that yourself.

You will probably run into timeout problems with Overpass, so think of downloading http://download.geofabrik.de/north-america/us/oregon-latest.osm.pbf and filter that locally. Or take a look at Sources for US Zip Code Boundaries? or https://www.census.gov/geo/maps-data/data/cbf/cbf_zcta.html