area
[place=region]
["region:type"="mountain_area"]
["name:en"="Dolomites"];
out body;
// get all peaks in the area
node
[natural=peak]
(area);
out;
area["ISO3166-1"="DE"][admin_level=2];
( node["amenity"="biergarten"](area);
way["amenity"="biergarten"](area);
rel["amenity"="biergarten"](area);
);
out center;
( node["amenity"="atm"]["currency:XBT"="yes"];
node["amenity"="atm"]["brand"="Bitcoin"];
node["amenity"="atm"]["name"="Bitcoin"];
);
out center;
rel[admin_level=2]["ISO3166-1"="DE"];
out geom;
To get the administrative boundary of a given country for other admin_level
use rel[admin_level=3]["is_in:country"="XX"];
and rel[admin_level=4]["ISO3166-2"~"^XX"]
. Details on the admin_level
tag can be found in the Key:boundary documentation.
Get all postal boundaries of Leipzig
area(3600062649);
rel(area)["boundary"="postal_code"];
out geom;
The area id can be calculated from an existing OSM way by adding 2400000000
to its OSM id, or in case of a relation by adding 3600000000
respectively. Note that not all ways/relations ave an area counterpart (tagged with area=no
, and most multipolygons and that don't have a defined name=*
will not be part of areas).
node[capital=yes]; out;
You can achieve this by either using an Area pivot
area[name="London"][admin_level=6][boundary=administrative]->.londonarea;
rel(pivot.londonarea);
out geom;
or by directly accessing the relation
rel[name="London"][admin_level=6][boundary=administrative];
out geom;
rel[name=Dublin][place=city][admin_level=7]; out bb;
Get all restaurants within 1 km radius around the Eiffel Tower
way[name="Tour Eiffel"];
(node[amenity=restaurant](around:1000.0);
way[amenity=restaurant](around:1000.0);
rel[amenity=restaurant](around:1000.0);
);
out;
where the format of around is (around[.input_set]:radius)
or (around:radius,latitude,longitude)
.
( node(3815147164); <; );
out geom;
where <
is recursive up and for relations you need to use <<
.
E.g. get all lanes in and from the City of London.
area[name="City of London"][type=boundary][boundary=administrative];
way["name"~"Lane"](area);
<;>;
out geom;
curl --globoff -o data.json http://overpass-api.de/api/interpreter?data=[out:json];node(1);out;
Note that the query after ?data=
has to be urlencoded and the --globoff
flag needs to be added not to interpret []{}
inside the url.