Saturday, 26 September 2015

How to filter relation members in Overpass


My final goal is to get country borders from OSM via Overpass API. I know my country's relation object id - http://www.openstreetmap.org/relation/59065 - and can get its details with the following query:


[out:json];
rel(59065);
out body;


The relation members list contains ways (which comprise the country border) as well as some other nodes and relations. How can I filter relation members to leave only way elements?



Answer



You cannot reduce the output of the relation itself (it will always include all elements). However, you can specify to only return ways, which are included in a relation:


[out:json];
rel(59065);
way(r);
out geom;

Try it in overpass turbo: http://overpass-turbo.eu/s/c0l and press "Run"



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...