This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Select specific postal_code

0

So the "ask first, the sign up" did not work for me.

The wiki for boundary:postal_code links to overpass turbo with the following query:

/*
This query looks for nodes, ways and relations 
with the given key/value combination.
Choose your region and hit the Run button above!
*/
[out:json][timeout:25];
// gather results
(
  // query part for: “boundary=postal_code”
  node["boundary"="postal_code"]({{bbox}});
  way["boundary"="postal_code"]({{bbox}});
  relation["boundary"="postal_code"]({{bbox}});
);
// print results
out body;
>;
out skel qt;

It shows all ZIP code boundaries visible on the map How can I filter for one specific code by adding postal_code=12345?

asked 02 Jun '22, 09:36

ohcomeon's gravatar image

ohcomeon
36112
accept rate: 50%


2 Answers:

0

Never mind, I tried the Wizard with "postal_code"=12345 and that generated pretty much the above code except for "postal_code"="12345" instead of "boundary"="postal_code"

answered 02 Jun '22, 09:47

ohcomeon's gravatar image

ohcomeon
36112
accept rate: 50%

0

https://overpass-turbo.eu/s/1iXL

rel[boundary=postal_code][postal_code=04030]({{bbox}});
out body;
>;
out skel qt;

Only relations need to be searched.

answered 02 Jun '22, 13:53

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

Source code available on GitHub .