Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSM Overpass: Query within relation

If I want to query for certain objects within an area, it's quite easy:

area(...);
node(area)[natural=peak];
out;

But what if the area is defined as a relation in the OSM database? I could query for the area like this ...

(rel(...);>;);
out;

... but how can I use the area filter on it then?

like image 512
Örom Loidl Avatar asked Oct 19 '25 14:10

Örom Loidl


1 Answers

You can either apply the same filter criteria to area, as you would for your relation - or - use map_to_area to calculate the corresponding area for a relation:

rel(...);map_to_area;
node(area)[natural=peak];
out;

Check out the documentation for more details.

like image 157
mmd Avatar answered Oct 22 '25 04:10

mmd