User:Binnette/OverpassQueries
Tools
Objects mapped as node, that 'can' be mapped as area
Get all camp_site mapped as nodes, they can be mapped as areas. Challenge: Convert camp site nodes to areas in France
area[name="France"]->.a;
node["tourism"="camp_site"](area.a);
out skel;
# | Challenge | Query |
---|---|---|
1 | Convert parking nodes to areas - World | area[name="France métropolitaine"]->.a;
node["amenity"="parking"]
["parking"="surface"]
["access"!="private"]
["fee"="no"](area.a);
out skel;
|
2 | Convert graveyard nodes to areas - France | area[name="France"]->.a;
node["amenity"="grave_yard"](area.a);
out skel;
|
3 | Convert place of worship nodes to areas - France | area[name="France métropolitaine"]->.a;
node["amenity"="place_of_worship"](area.a);
out body;
|
4 | Convert football pitch nodes to areas - World | area[name="France métropolitaine"]->.a;
node(area.a)[leisure=pitch][sport=soccer];
out geom;
|
5 | Convert cemetery nodes to areas - World | area[name="XX"]->.a; // FR, PT, etc.
node["landuse"="cemetery"](area.a);
out skel;
|
6 | Convert areas from picnic table to picnic site - World | way["leisure"="picnic_table"][amenity!=shelter];
out body geom;
|
7 | Convert minigolf nodes to areas - World | node["leisure"="miniature_golf"];
out body;
|
8 | Convert golf nodes to areas - World | node["leisure"="golf_course"];
out body geom;
|
9 | Convert american football pitch nodes to areas - World | node[leisure=pitch][sport=american_football];
out body geom;
|
10 | Convert stadium nodes to areas - World | node[leisure=stadium];
out body geom;
|
11 | Convert baseball pitch nodes to areas - World | node[leisure=pitch][sport=baseball];
out body geom;
|
12 | Turn solar panel from node to area - France | area[name="France"]->.a;
node
[power=generator]
["generator:source"=solar]
[!support]
(area.a);
out body geom;
|
13 | Convert playground node to area - France (38) | area[name=Grenoble]->.a;
node[leisure=playground][!playground](area.a);
out body geom;
|
14 | Convert basketball pitch from node to area - World | node[leisure=pitch][sport=basketball];
out ids geom;
|
15 | Convert swimming pool nodes to area France | area[name="France métropolitaine"]->.a;
node["leisure"="swimming_pool"](area.a);
out body;
|
Shops without proper brand tags
Get all 'Burger King' fast-food that don't have the proper brand tags. Challenge: Add brand tags for Burger King - World
area[name="France métropolitaine"]->.a;
(
node[name~"Burger King",i][!"brand:wikidata"](area.a);
way[name~"Burger King",i][!"brand:wikidata"](area.a);
)->.all;
nw.all[!highway][!bus][!place][!power][!information][amenity!=parking];
out body geom;
# | Challenge | Query |
---|---|---|
1 | Add proper tags for Quick (fast food) - World | area[name="France métropolitaine"]->.a;
(
node[name="Quick"][!"brand:wikidata"](area.a);
way[name="Quick"][!"brand:wikidata"](area.a);
);
out body geom;
|
2 | Add brand tags for Subway - World | nw[name="Subway"][amenity][!"brand:wikidata"];
out body geom;
|
3 | Add proper tags to KFC - World | area[name="France"]->.a;
(
node[name~"KFC",i][!"brand:wikidata"](area.a);
way[name~"KFC",i][!"brand:wikidata"](area.a);
)->.all;
nw.all[!highway][!bus][!place][!power][!information][amenity!=parking];
out body geom;
|
4 | Add proper tags to McDonald's - World | area[name="France"]->.a;
(
node[name~"McDonald",i][!"brand:wikidata"](area.a);
way[name~"McDonald",i][!"brand:wikidata"](area.a);
)->.all;
nw.all[!highway][!bus][!place][!power][!information];
out body geom;
|
5 | Ajout de tags brand sur les supermarchés en France | [out:json][timeout:850];
area["wikidata"="Q142"]->.france;
node["shop"="supermarket"]
["brand:wikidata"!~".*"]
["brand"!~".*"]
["name"]
(area.france);
out center;
|
6 | Add missing tags to "Big Fernand" fast-food - France | area[name="France"]->.a;
(
nw[name="Big Fernand"][!"brand"](area.a);
nw[name="Big Fernand"][!"brand:wikidata"](area.a);
nw[name="Big Fernand"]["brand:wikidata"!="Q19521346"](area.a);
nw[name="Big Fernand"][!"brand:wikipedia"](area.a);
nw[name="Big Fernand"][!"cuisine"](area.a);
nw[name="Big Fernand"][!"takeaway"](area.a);
nw[name="Big Fernand"]["takeaway"!="yes"](area.a);
nw[name="Big Fernand"][!"amenity"](area.a);
nw[name="Big Fernand"]["amenity"!="fast_food"](area.a);
nw[name="Big Fernand"][!"website"](area.a);
);
out ids geom;
|
7 | Add missing tags to "Buffalo Grill" (restaurant) - World | area[name="France"]->.a;
(
nw[name="Buffalo Grill"][!amenity](area.a);
nw[name="Buffalo Grill"][amenity!=restaurant](area.a);
nw[name="Buffalo Grill"][!brand](area.a);
nw[name="Buffalo Grill"][brand!="Buffalo Grill"](area.a);
nw[name="Buffalo Grill"][!"brand:wikidata"](area.a);
nw[name="Buffalo Grill"]["brand:wikidata"!="Q944655"](area.a);
nw[name="Buffalo Grill"][!"brand:wikipedia"](area.a);
nw[name="Buffalo Grill"][!"cuisine"](area.a);
nw[name="Buffalo Grill"]["cuisine"!="steak_house"](area.a);
);
out body geom;
|
Missing tag: direction
Get all stops that don't have the direction tag and are not located on a one-way road. Challenge: Add direction to Stop in France
area[name="France"]->.a;
node["highway"="stop"][!"direction"](area.a);
way(bn)["highway"]["oneway"!="yes"];
node(w)["highway"="stop"][!"direction"];
out skel;
# | Challenge | Query |
---|---|---|
1 | Add direction to give way in France
Get give_way that don't have the direction tag and are not located on a one-way road. |
area[name="France"]->.a;
node["highway"="give_way"][!"direction"](area.a);
way(bn)["highway"]["oneway"!="yes"];
node(w)["highway"="give_way"];
out skel;
|
2 | Add direction to traffic signals - France | area["ISO3166-2"="FR-ARA"]->.ARA; // Auvergne-Rhône-Alpes
node(area.ARA)
[traffic_signals=signal]
[!"traffic_signals:direction"]->.sign;
way[highway][oneway=yes](bn.sign);
node(w)
[traffic_signals=signal]
[!"traffic_signals:direction"]->.signOneWay;
(.sign; - .signOneWay;);
out meta;
|
Query on angles with the functions per_vertex and angle
Challenge: Impossible angles - France
area[name="Isère"]->.a;
way(area.a)
[highway~"motorway|trunk|primary|secondary|tertiary|unclassified|residential|service"]
(if:lrs_in(1,per_vertex(angle() < -170 || angle() > 170)));
node(w)(if:lrs_in(id(),set(per_vertex((angle() < -170 || angle() > 170) ? ref() : 0))));
out geom;
Run query: http://overpass-turbo.eu/s/1B2h
MapRoulette challenges
France
Num | Link | Overpass query |
---|---|---|
4 | Update buildings with fixme from cadastre in France
Get ways with a fixme that contains the word 'cadastre'. Filter to keep only the ways not modified since the date (2016-01-01). Finally filter the ways to keep only the buildings. |
area[name="France"]->.a;
(
way["fixme"~"cadastre",i](area.a);
-
way._(newer:"2016-01-01T00:00:00Z")["fixme"~"cadastre",i](area.a);
)->.x;
way.x["building"];
out geom; // for ways, you must use "out geom"
|
10 | Replace shop=yes by more specific shop value in France |
area[name="France métropolitaine"]->.a;
(
node["shop"="yes"][name](area.a);
way["shop"="yes"][name](area.a);
);
out body geom;
Find shop with name="Easy Cash" and shop!=yes: area[name="France métropolitaine"]->.a;
(
node[name="Easy Cash"][shop][shop!=yes](area.a);
way [name="Easy Cash"][shop][shop!=yes](area.a);
);
out body geom;
|
14 | Fix "roads" on building - France (38)
Ok, so this query is very long... May be it is not very 'optimized' but it works. ^^' |
area[name="Isère"]->.a;
// roads
way(area.a)[highway]
[highway!=pedestrian]
[highway!=footway]
[highway!=platform]
[highway!=steps]
[highway!=path]
[highway!=bus_stop]
[highway!=living_street]
[!layer]
[!tunnel];
(._;>;)->.nhighways;
// tunnels & way with layer
(
way(area.a)[highway][tunnel];
way(area.a)[highway][layer];
);
(._;>;)->.ntunnels;
// buildings ways
way(area.a)[building]
[!"building:levels"]
[building!=roof]
[wall!=no]
[!layer];
(._;>;);
// building nodes but not entrance
node._[amenity!=parking_entrance]
[!entrance]->.nbuildings;
// node that are from building & roads
// except tunnels node
(
node.nhighways.nbuildings;
-
node.ntunnels;
);
out ids geom;
|
14b | Fix "roads" on building - France (38)
Version 2. I used map_to_area to convert buildings to areas |
area[name="Isère"]->.a;
// buildings
way(area.a)[building]
[!"building:levels"]
[building!=roof]
[wall!=no]
[!layer];
// area covered by building
map_to_area -> .areabuilding;
// roads
way(area.areabuilding)[!layer][!tunnel][highway] -> .highways;
(
way.highways[highway=living_street];
way.highways[highway=motorway];
way.highways[highway=motorway_junction];
way.highways[highway=motorway_link];
way.highways[highway=path];
way.highways[highway=primary];
way.highways[highway=primary_link];
way.highways[highway=residential];
way.highways[highway=road];
way.highways[highway=secondary];
way.highways[highway=secondary_link];
way.highways[highway=service];
way.highways[highway=services];
way.highways[highway=tertiary];
way.highways[highway=tertiary_link];
way.highways[highway=track];
way.highways[highway=trunk];
way.highways[highway=trunk_link];
way.highways[highway=unclassified];
);
out body geom;
|
16 | Add missing giveways to roundabout - France (38) |
area[name="Grenoble"]->.a;
way[junction=roundabout](area.a)->.round;
node[highway=give_way](around.round:10);
way[junction=roundabout](around:10);
complete {
node(w);
way[junction=roundabout](bn);
}
(._;)->.roundWithGive;
(.round; - .roundWithGive;)->.roundNoGive;
foreach.roundNoGive->.c {
way.c.visited;
if (count(ways) == 0){
.c;
complete {
node(w);
way[junction=roundabout](bn);
}
(._;)->.new;
way.new.ok;
if (count(ways) == 0){
(.c;.ok;)->.ok;
}
(.new; .visited;)->.visited;
}
}
way.ok;
out geom;
//debug only
//node[highway=give_way](area.a);
//out geom;
{{style:
way[junction=roundabout]{
fill-color: red;
color: red;
}
node[highway=give_way]{
fill-color: green;
color: green;
}
}}
|
17 | Fuel stations too far from road - France (38) |
area[name="Isère"]->.a;
nw[amenity=fuel](area.a)->.allfuel;
()->.ok;
foreach.allfuel->.c {
way[highway](around.c:15);
if (count(ways)==0){
(.c;.ok;)->.ok;
}
}
nw.ok;
out geom;
|
18 | Extract give way from roundabout - France |
area[name="France"]->.a;
node[highway=give_way][direction](area.a);
way(bn)[junction=roundabout];
node(w)[highway=give_way][direction];
out ids geom;
|
21 | Fix ways without tag - France (38) |
area[name="Isère"]->.a;
way(area.a)(if:count_tags() == 0)->.all;
rel(bw.all);
way(r)->.withRel;
(.all; - .withRel;);
out geom;
|
22 | Add footways in cemetery - France (38) |
area[name="Isère"] -> .a;
way[landuse=cemetery](area.a) -> .all;
() -> .noway;
foreach.all -> .cem {
way[highway](around.cem:0);
if (count(ways) == 0) {
(.cem;.noway;) -> .noway;
}
}
.noway;
out ids geom;
|
25 | Fire station too close to another one - France |
area["ISO3166-2"="FR-ARA"]->.ARA; // Auvergne-Rhône-Alpes
()->.ko;
(
nw[amenity=fire_station](area.ARA);
//nw[amenity=fire_station](area.BFC);
//...
)->.allstations;
foreach.allstations->.s {
nw[amenity=fire_station](around.s:50);
if (count(nw) > 1) {
(.s;.ko;)->.ko;
}
}
nw.ko;
out geom;
|
26 | Fire station too close to another one |
area["ISO3166-2"="FR-ARA"]->.ARA; // Auvergne-Rhône-Alpes
//... other regions
nw[amenity=fire_station](area.ARA)->.allstations;
()->.ko;
foreach.allstations->.s {
nw[amenity=fire_station](around.s:50);
if (count(nw) > 1) {
(.s;.ko;)->.ko;
}
}
nw.ko;
out geom;
|
27 | Fix areas without tag - France |
area["ISO3166-2"="FR-ARA"]->.ARA; // Auvergne-Rhône-Alpes
//... other regions
way(area.ARA)["area"](if:count_tags() == 1)->.all;
rel(bw.all);
way(r)->.withRel;
(.all; - .withRel;);
out geom;
|
29 | Police station too close to another one - France |
Same as previous fire station challenge. But this time I used QGIS to filter data returned by Overpass API. |
30 | Townhall too close to another one - France |
Same as previous fire station challenge. But this time I used QGIS to filter data returned by Overpass API. |
31 | Stop should be on a highway - France |
area["ISO3166-2"="FR-ARA"]->.ARA; // Auvergne-Rhône-Alpes
//... other regions
node[highway=stop](area.ARA)->.all;
way[highway](bn.all);
node[highway=stop](w)->.withWay;
(.all; - .withWay;);
out geom;
|
32 | Add missing give ways around mini roundabout - France |
area["ISO3166-2"="FR-ARA"]->.ARA; // Auvergne-Rhône-Alpes
//... other regions
node[highway=mini_roundabout](area.ARA)->.mini;
node[highway=give_way](around.mini:30);
node[highway=mini_roundabout](around:30)->.miniWithGive;
(.mini; - .miniWithGive;);
out geom;
|
34 | Add incline to stairs in France |
area["ISO3166-2"="FR-ARA"]->.ARA; // Auvergne-Rhône-Alpes
way(area.ARA)(if: length() > 100)
[highway=steps]
[!incline];
out geom;
|
35 | Add elevation (tag ele) for natural=peak |
area["ISO3166-2"="FR-ARA"]->.ARA; // Auvergne-Rhône-Alpes
node["natural"="peak"][!ele][!height][!historic][!place][!sport][name](area.ARA);
out meta;
|
36 | The website of this shop is down. Update website or remove the shop if closed |
I. Find shops with website and export to csv: [out:csv(::id,::type,name,shop,website;false;";")];
area["ISO3166-2"="FR-ARA"]->.ARA; // Auvergne-Rhône-Alpes
(
node["shop"]["website"](area.ARA);
way["shop"]["website"](area.ARA);
);
out body;
II. Test website with bash/curl: #!/bin/bash INPUT=shop.csv OLDIFS=$IFS IFS=';' [ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; } echo "id;type;statut;name;shop;website" > res.csv while read id type name shop website do response=$(curl --write-out '%{http_code}' --silent --output /dev/null $website) firstChar=${response:0:1} if [ $firstChar != 2 ] && [ $firstChar != 3 ] then echo "❌ $response => $website" echo "$id;$type;ko;$name;$shop;$website" >> res.csv else echo "✅ $response => $website" fi done < $INPUT IFS=$OLDIFS III. Create a MapRoulette challenge with the query (replace the shop ids): (
way(45252078);
way(48917262);
way(58979580);
//... others shop with dead website
);
out meta geom;
|
37 | Add the artwork_type of this artwork - France |
area[name="France"]->.a;
(
node["tourism"="artwork"][!"artwork_type"]["description"](area.a);
node["tourism"="artwork"][!"artwork_type"]["mapillary"](area.a);
node["tourism"="artwork"][!"artwork_type"]["name"](area.a);
node["tourism"="artwork"][!"artwork_type"]["wikimedia_commons"](area.a);
//node["tourism"="artwork"][!"artwork_type"]["artwork_subject"](area.a);
//node["tourism"="artwork"][!"artwork_type"]["website"](area.a);
//node["tourism"="artwork"][!"artwork_type"]["wikidata"](area.a);
//node["tourism"="artwork"][!"artwork_type"]["wikipedia"](area.a);
);
out body geom;
|
38 | This "parking space" is too big. Should it be a parking lot instead? - France #QuickFix |
way
[amenity=parking_space]
[capacity=1]
[!parking_space]
(if:is_closed()==1)
(if:length()>100);
out geom;
Then open the data in JSOM and change all amenity=parking_space to amenity=parking. Save the changes in an osm file. Use this command on the file: mr cooperative tag parking.osm --out parking.geojson Finally, create a new MapRoulette challenge and upload the geojson file. |
39 | Wrong direction for stop on one way road in France |
area[name="France"]->.a;
node[highway=stop][direction=backward](area.a);
way(bn)[highway][oneway=yes];
node(w)[highway=stop][direction=backward];
out skel;
|
40 | Node amenity=school should probably be merged in the enclosing way amenity=school - Grenoble |
area[name="Grenoble"]->.a;
node[amenity=school](area.a);
way [amenity=school](around:10);
node[amenity=school](around:10);
(._;>;);
out meta;
|
41 | Add elevation (tag ele) for tourism=alpine_hut |
area["ISO3166-2"="FR-ARA"]->.ARA; // Auvergne-Rhône-Alpes
nw["tourism"="alpine_hut"][name][!ele](area.ARA);
out body;
>;
out skel qt;
|
42 | Waterfall should be on a river - France |
// Get area of "France métropolitaine"
area[name="France métropolitaine"]->.FRM;
// Get waterfalls within `.FRM`
node[waterway=waterfall](area.FRM)->.waterfall;
// Get parent waterway of waterfall node (if any)
way[waterway](bn.waterfall);
// Get child waterfall nodes from those parents waterway
node[waterway=waterfall](w)->.withWaterway;
// Get parent water body of waterfall nodes (if any)
way[natural=water](bn.waterfall);
// Get child waterfall nodes from those parents water body
node[waterway=waterfall](w)->.withNaturalWater;
// Combine `.withWaterway` and `.withNaturalWater`
(.withWaterway; .withNaturalWater;) -> .withWater;
// Get waterfalls that are not part of waterway or water body
(.waterfall; - .withWater;);
out body;
|
World
Num | Link | Overpass query |
---|---|---|
12 | Guidepost elevation should be stored in the tag ele - World |
(
node[information=guidepost][name~"[0-9]+m$"][!ele][!running];
node[information=guidepost][name~"[0-9]+mt"][!ele][!running];
node[information=guidepost][name~"[0-9]+m)"][!ele][!running];
node[information=guidepost][name~"[0-9]+m."][!ele][!running];
node[information=guidepost][name~"[0-9]+m "][!ele][!running];
node[information=guidepost][height~'[0-9][0-9]+'][!ele];
);
out body geom;
|
Other users queries
Num | Link | Overpass query |
---|---|---|
1 | Add artwork_type=* to artworks based on images. |
(
nwr["tourism"="artwork"][!"artwork_type"]["image"];
nwr["tourism"="artwork"][!"artwork_type"]["wikimedia_commons"];
nwr["tourism"="artwork"][!"artwork_type"]["mapillary"];
nwr["tourism"="artwork"][!"artwork_type"]["flickr"];
);
out meta;
>;
out skel qt;
|
2 | Global: Improve:/Fix tag "access=public" |
[out:json][timeout:3600];
(
node["access"="public"];
way["access"="public"];
relation["access"="public"];
);
out center;
|
3 | Museums without a website in France |
node
[tourism=museum]
[!website]
[!'contact:website']
[!url]
(area:3601403916);
out;
|
MapRoulette QuickFix challenges
Peak elevation in name instead of ele tag
For node natural=peak, the elevation should be stored in ele=* not un name=*.
Step | Action |
---|---|
1) Get peaks with elevation in name | (
node[natural=peak][!ele][name~"[0-9]{3,}m"];//(area.a);
node[natural=peak][!ele][name~"[0-9]{3,} m"];//(area.a);
);
out meta;
|
2) Compute data on JOSM via plugin "Scripting" | Install the plugin scripting in JOSM. Then import the peaks in a layer "peaks.osm".
And run the following script: var layer = josm.layers.get("peaks.osm"); var ds = layer.data; var r = RegExp(/[0-9]+\s{0,1}m/); ds.each(function(n) { oldname = n.tags.name.replace("(","").replace(")",""); if (oldname.search(r) > 0) { n.tags.name = oldname.replace(r, "").trim(); n.tags.ele = oldname.match(r).join().replace("m", "").trim(); } }); josm.alert("End of script"); Then save the modification in an "peaks-changes.osm" file. |
3) Create and import the tasks in MapRoulette | Install the mr-cli node module command line.
Then run the following command: mr cooperative tag peaks-changes.osm --out peaks-quickfix.geojson Then import the geojson file in a new MapRoulette challenge |
Peak elevation in height instead of ele tag
Step 1 | Step 2 | Step 3 |
---|---|---|
node[natural=peak][!ele][height];
out meta;
|
var layer = josm.layers.get("peak-height.osm"); var ds = layer.data; ds.each(function(n) { var h = n.tags.height.replace("m",""); h = h.replace("(","").replace(")",""); n.tags.ele = h.trim(); n.tags.height = ""; }); josm.alert("End of script"); |
mr cooperative tag peaks-height.osm --out peaks-height-qf.geojson |
Extract peak elevation from wikidata
- Challenge: https://maproulette.org/browse/challenges/23281
- How to create this challenge: https://github.com/Binnette/mr-challenges/tree/main/peak-ele-wikidata
Filter Overpass queries by area
You can filter your query by area, here is an example for 'France métropolitaine:
area[name="France métropolitaine"]->.a;
node["tourism"="camp_site"](area.a);
out skel;
You can also use the function 'geocodeArea' to get your area :
[[:Template:GeocodeArea:France métropolitaine]]->.a;
node["tourism"="camp_site"](area.a);
out skel;
# | Areas | Filters |
---|---|---|
1 | Metropolitan France | area[name="France métropolitaine"]->.FRM;
area["ISO3166-2"="FR-ARA"]->.ARA; // Auvergne-Rhône-Alpes
area["ISO3166-2"="FR-BFC"]->.BFC; // Bourgogne-Franche-Comté
area["ISO3166-2"="FR-BRE"]->.BRE; // Bretagne
area["ISO3166-2"="FR-CVL"]->.CVL; // Centre-Val de Loire
area["ISO3166-2"="FR-COR"]->.COR; // Corse
area["ISO3166-2"="FR-GES"]->.GES; // Grand Est
area["ISO3166-2"="FR-HDF"]->.HDF; // Hauts-de-France
area["ISO3166-2"="FR-IDF"]->.IDF; // Île-de-France
area["ISO3166-2"="FR-NOR"]->.NOR; // Normandie
area["ISO3166-2"="FR-NAQ"]->.NAQ; // Nouvelle-Aquitaine
area["ISO3166-2"="FR-OCC"]->.OCC; // Occitanie
area["ISO3166-2"="FR-PDL"]->.PDL; // Pays de la Loire
area["ISO3166-2"="FR-PAC"]->.PAC; // Provence-Alpes-Côte d'Azur
// Regions grouped by location: North/South
(.BFC;.BRE;.CVL;.GES;.HDF;.IDF;.NOR;.PDL;)->.N; // Nord
(.ARA;.COR;.NAQ;.OCC;.PAC;)->.S; // Sud
// Regions grouped by location: NW/NE/SW/SE
(.BRE;.CVL;.IDF;.NOR;.PDL;)->.NO;
(.BFC;.GES;.HDF;)->.NE;
(.NAQ;.OCC;)->.SO;
(.ARA;.COR;.PAC;)->.SE;
rel(area.ARA)["name"="Ardèche"];
way(r);
out body;
>;
out skel qt;
|
2 | Overseas France | // DROM
area["ISO3166-2"="FR-GP"]->.GP; // Guadeloupe
area["ISO3166-2"="FR-GF"]->.GF; // Guyane (française)
area["ISO3166-2"="FR-MQ"]->.MQ; // Martinique
area["ISO3166-2"="FR-RE"]->.RE; // La Réunion
area["ISO3166-2"="FR-YT"]->.YT; // Mayotte
// Dependency
area["ISO3166-2"="FR-CP"]->.CP; // Île de Clipperton
// COM
area["ISO3166-2"="FR-BL"]->.BL; // Saint-Barthélemy
area["ISO3166-2"="FR-MF"]->.MF; // Saint-Martin
area["ISO3166-2"="FR-NC"]->.NC; // Nouvelle-Calédonie
area["ISO3166-2"="FR-PF"]->.PF; // Polynésie française
area["ISO3166-2"="FR-PM"]->.PM; // Saint-Pierre-et-Miquelon
area["ISO3166-2"="FR-TF"]->.TF; // Terres australes et antarctiques françaises
area["ISO3166-2"="FR-WF"]->.WF; // Wallis-et-Futuna
node(area.GP)[amenity=bench];
out;
|
3 | European countries | // West Europe
area["ISO3166-1"=AT]->.AT; //Austria
area["ISO3166-1"=BE]->.BE; //Belgium
area["ISO3166-1"=CZ]->.CZ; //Czech Republic
area["ISO3166-1"=DK]->.DK; //Denmark
area["ISO3166-1"=ES]->.ES; //Spain
area["ISO3166-1"=FR]->.FR; //France
area["ISO3166-1"=GB]->.GB; //United Kingdom
area["ISO3166-1"=HR]->.HR; //Croatia
area["ISO3166-1"=MT]->.MT; //Malta
area["ISO3166-1"=IE]->.IE; //Ireland
area["ISO3166-1"=IT]->.IT; //Italy
area["ISO3166-1"=LU]->.LU; //Luxembourg
area["ISO3166-1"=NL]->.NL; //Netherlands
area["ISO3166-1"=PT]->.PT; //Portugal
// East Europe
area["ISO3166-1"=BG]->.BG; //Bulgaria
area["ISO3166-1"=CY]->.CY; //Cyprus
area["ISO3166-1"=DE]->.DE; //Germany
area["ISO3166-1"=EE]->.EE; //Estonia
area["ISO3166-1"=FI]->.FI; //Finland
area["ISO3166-1"=GR]->.GR; //Greece
area["ISO3166-1"=HU]->.HU; //Hungary
area["ISO3166-1"=LT]->.LT; //Lithuania
area["ISO3166-1"=LV]->.LV; //Latvia
area["ISO3166-1"=PL]->.PL; //Poland
area["ISO3166-1"=RO]->.RO; //Romania
area["ISO3166-1"=SE]->.SE; //Sweden
area["ISO3166-1"=SI]->.SI; //Slovenia
area["ISO3166-1"=SK]->.SK; //Slovakia
|
4 | France county | Import des ornes de recharges pour véhicules électriques en Ardèche
area["ISO3166-2"="FR-07"]->.a;
(
node["amenity"="charging_station"](area.a);
way["amenity"="charging_station"](area.a);
);
out body;
>;
out skel qt;
Import des campings en Ardèche area["ISO3166-2"="FR-07"]->.a;
(
node["tourism"="camp_site"](area.a);
way["tourism"="camp_site"](area.a);
);
out body;
>;
out meta qt;
|
Performances
[out:json];
nw[name="KFC"]
// Arbitrary polygon containing Metropolitan France (without Corsica)
(poly:"42.1 3.0 42.9 -1.6 48.5 -5.0 51.3 2.2 49.0 8.25 43.2 7.8 42.1 3.0");
out body geom;
// Take 18 seconds
[out:json];
area[name="France métropolitaine"]->.a;
nw[name="KFC"](area.a);
out body geom;
// Take 24 seconds but contains also Corsica
// Just a simple box around Metropolitan France (with Corsica)
[out:json][bbox:41.32,-5.15,51.1,9.6];
nw[name="KFC"];
out body geom;
// Take 28 seconds
[out:json];
area["ISO3166-2"="FR-ARA"]->.ARA; // Auvergne-Rhône-Alpes
nw[name="KFC"](area.ARA);
out body geom;
// Take 40 seconds
Tips
Description | Query |
---|---|
Search in multiple area.
You can join multiple places in a single area. |
(
area[name="Mariac"];
area[name="Accons"];
)->.a;
nw[amenity](area.a);
out geom;
|
Search for a given value for any key | area[name="Mariac"]->.a;
nw[~".*"~"Dorne"](area.a);
out geom;
|
Search for a given value for any key
^ starting or $ ending with specific char |
area[name="Mariac"]->.a;
nw[~".*"~"00$"](area.a);
out geom;
|
Logical OR in values with a 'pipe' ∣
values église or école i for case insensitive |
area[name="Mariac"]->.a;
nw["name"~"église∣école",i](area.a);
out geom;
|
Convert a way or rel to an area | area[name="Grenoble"]->.gre;
way(area.gre)[leisure=park];
map_to_area->.park;
(
node(area.park)[amenity=bench];
node(area.park)[leisure=picnic_table];
);
out geom;
|
Using 'pivot' to get the relation of an area | area[name="Mariac"]->.a;
rel(pivot.a);
out geom;
|
I want a picnic table near drinking water and shelter | area[name="Isère"]->.a;
node(area.a)[amenity=drinking_water];
node(around:100)[leisure=picnic_table]->.tableNearWater;
nw(area.a)[amenity=shelter];
node(around:100)[leisure=picnic_table]->.tableNearShelter;
node.tableNearWater.tableNearShelter;
out geom;
|
My OSM edits
Description | Query |
---|---|
My edits in Grenoble | area[name="Grenoble-Alpes Métropole"]->.a;
(
node(area.a)(user:Binnette);
way (area.a)(user:Binnette);
);
out geom;
|
My edits in Mariac | area[name="Mariac"]->.a;
nwr(area.a)(user:Binnette);
out geom;
|