Wednesday, 2 January 2019

openstreetmap - Overpass XML query for finding all buildings inside a polygon


I want to run following Overpass QL query in order to get way IDs of all buildings inside a polyon:


way(poly:"50.7 7.1 50.7 7.2 50.75 7.15")[building];
>;
out ids;


Since I'm using the osm-common library, I need to convert this script to Overpass XML. I did it using the convert form here.


The result:












But when I run it, I get node IDs, not way IDs.




The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.




















...









How should I modify the Overpass XML query in order to get way IDs of the buildings?



Answer



When I manually enter a Query for ways Overpass turbo suggests an auto repair so as to also get nodes for the way. This then amounts to


way(poly:"50.7 7.1 50.7 7.2 50.75 7.15")["building"];
/*added by auto repair*/
(._;>;);
/*end of auto repair*/
out body;


see http://overpass-turbo.eu/s/1q1 .


Change out body to out ids if you really only want way IDs, but without the information which node belongs to which way.


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...