How can I use the overpass-API to recursively get all nodes and their coordinates which belong to the ways of an relation? I need this to draw bounding polygons of all the postal areas inside a city.
I have the following query:
This returns all relations with postal boundary inside the queried area and all the ways of these relations, however it does not return the nodes/coordinates of the points which make up these ways:
...
...
....
I would like to get a list of postal areas with their nodes, like this:
....
...
The tag with the postal code should still be included so I can distinguish all received postal areas.
Answer
I would recommend the following approach: it returns coordinates for ways' nodes 'in place', like you described in your question.
The only thing, which is missing in the output is the technical OSM node-id (ref
). I assume that for use case of drawing some boundary area on a map, this is most likely not needed. If you take a look at the screenshot below, overpass turbo is drawing all postal code areas on the map without any issue.
area(3600062649);
rel(area)["boundary"="postal_code"];
out geom;
http://overpass-turbo.eu/s/7In
Example output:
[...]
[...]
No comments:
Post a Comment