1

In OSM I would like depict a certain area ("working area"). Using the following I can specify a certain area around a certain city:

[out:json][timeout:800];
{{geocodeArea:Netherlands}}->.searchArea;
{{radius=40000}}
(
  node["admin_level"="8"](area.searchArea)(around:{{radius}}, {{geocodeCoords:Oirschot}});  
  relation["admin_level"="8"](area.searchArea)(around:{{radius}}, {{geocodeCoords:Oirschot}});
);
out body;
>;
out skel qt;

However the radius does not deliver the required area. An alternative is to use the postal code, which might look like:

/*
[out:json][timeout:25];
// fetch area “Eindhoven” to search in
{{geocodeArea:Eindhoven}}->.searchArea;
(
  node["addr:postcode"~"^56"](area.searchArea);
  way["addr:postcode"~"^56"](area.searchArea);
  relation["addr:postcode"~"^56"](area.searchArea);
);
out body;
>;
out skel qt;

I am struggling in finding the administrative border of the latter result, such that I can improve the first code snippet to specify the cities based on a list of postalcodes.

Which direction I should look for?

4
  • Postal codes are linear or even point features. You cannot reliably convert them to polygon without error. – Vince Mar 1 '20 at 11:51
  • Maybe I was not complete enough: I would like to check if the given postalcodes are within a certain admin level and if so show the admin level (such that I can remove the radius approach in the first example). There's an example with banks & police stations (wiki.openstreetmap.org/wiki/Overpass_API/…), but I can not find how to check if a certain postcode is within a certain administrative boundry. – significant Mar 1 '20 at 18:10
  • Postcodes often cross administrative boundaries. – Vince Mar 1 '20 at 18:16
  • So, than it might be possible to highlight both administrative boundaries. So basicaly, check if a postalcode belongs to an administrative boundry and if so highlight the administrative boundry. – significant Mar 2 '20 at 13:40

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.