User:Binnette/OverpassQueries

From OpenStreetMap Wiki
Jump to navigation Jump to search

Tools

MapRoulette challenges

France

Num Link Overpass query
1 Add direction to Stop in France
try it yourself in overpass-turbo
area[name="France"]->.a;
node["highway"="stop"][!"direction"](area.a);
way(bn)["highway"]["oneway"!="yes"];
node(w)["highway"="stop"][!"direction"];
out skel;
2 Add direction to give way in France
try it yourself in overpass-turbo
area[name="France"]->.a;
node["highway"="give_way"][!"direction"](area.a);
way(bn)["highway"]["oneway"!="yes"];
node(w)["highway"="give_way"];
out skel;
3 Convert cemetary nodes to areas in France
try it yourself in overpass-turbo
area[name="France"]->.a;
node["landuse"="cemetery"](area.a);
out skel;
4 Update buildings with fixme from cadastre in France
try it yourself in overpass-turbo
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"
5 Convert parking nodes to areas in France
try it yourself in overpass-turbo
area[name="France métropolitaine"]->.a;
node["amenity"="parking"]["parking"="surface"]
  ["access"!="private"]["fee"="no"](area.a);
out skel;
6 Convert camp site nodes to areas in France
try it yourself in overpass-turbo
area[name="France"]->.a;
node["tourism"="camp_site"](area.a);
out skel;
7 Convert graveyard nodes to areas in France
try it yourself in overpass-turbo
area[name="France"]->.a;
node["amenity"="grave_yard"](area.a);
out skel;
8 Convert place of worship nodes to areas in France
try it yourself in overpass-turbo
area[name="France métropolitaine"]->.a;
node["amenity"="place_of_worship"](area.a);
out body;
9 Add brand tags for Burger King in France
try it yourself in overpass-turbo
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;
10 Replace shop=yes by more specific shop value in France
try it yourself in overpass-turbo
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:

try it yourself in overpass-turbo
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;
11 Add proper tags to KFC - France
try it yourself in overpass-turbo
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;
12 Add proper tags to McDonald's - France
try it yourself in overpass-turbo
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;
13 Add brand tags for Quick in France
try it yourself in overpass-turbo
area[name="France métropolitaine"]->.a;
(
  node[name="Quick"][!"brand:wikidata"](area.a);
  way[name="Quick"][!"brand:wikidata"](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. ^^'

try it yourself in overpass-turbo
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._
  [!entrance]
  [amenity!=parking_entrance]->.nbuildings;

// node that are from building & roads
// except tunnels node
(
  node.nhighways.nbuildings;
  -
  node.ntunnels;
);

out ids geom;
15 Convert football pitch nodes to areas - France
try it yourself in overpass-turbo
area[name="France métropolitaine"]->.a;
node(area.a)[leisure=pitch][sport=soccer];
out geom;
16 Add missing giveways to roundabout - France (38)
try it yourself in overpass-turbo
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)
try it yourself in overpass-turbo
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
try it yourself in overpass-turbo
area[name="France"]->.a;
node[highway=give_way][direction](area.a);
way(bn)[junction=roundabout];
node(w)[highway=give_way][direction];
out ids geom;
19 Add missing tags to "Big Fernand" fast food - France
try it yourself in overpass-turbo
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;
20 Add missing tags to "Buffalo Grill" (restaurant) - France
try it yourself in overpass-turbo
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;
21 Fix ways without tag - France (38)
try it yourself in overpass-turbo
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)
try it yourself in overpass-turbo
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;
23 Turn solar panel from node to area - France
try it yourself in overpass-turbo
area[name="France"]->.a;
node
 [power=generator]
 ["generator:source"=solar]
 [!support]
 (area.a);
out body geom;
24 Convert playground node to area - France (38)
try it yourself in overpass-turbo
area[name=Grenoble]->.a;
node[leisure=playground][!playground](area.a);
out body geom;
25 Fire station too close to another one - France
try it yourself in overpass-turbo
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
try it yourself in overpass-turbo
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
try it yourself in overpass-turbo
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;
28 Impossible angles - France
try it yourself in overpass-turbo
area[name="Isère"]->.a;
way(area.a)
  [highway~"motorway
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
try it yourself in overpass-turbo
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
try it yourself in overpass-turbo
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;
33 Add direction to traffic signals - France
try it yourself in overpass-turbo
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;
34 Add incline to stairs in France
try it yourself in overpass-turbo
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
try it yourself in overpass-turbo
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:

try it yourself in overpass-turbo
[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):

try it yourself in overpass-turbo
(
  way(45252078);
  way(48917262);
  way(58979580);
  //... others shop with dead website
);
out meta geom;
37 Add the artwork_type of this artwork - France
try it yourself in overpass-turbo
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
try it yourself in overpass-turbo
area[name="France"]->.a;
way[amenity=parking_space][!capacity](if: length() > 100)(area.a);
(._;>;);
out meta;

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.

World

Num Link Overpass query
1 Convert cemetary nodes to areas in Western Europe
try it yourself in overpass-turbo
area[name="XX"]->.a; // FR, PT, etc.
node["landuse"="cemetery"](area.a);
out skel;
2 Convert cemetary nodes to areas in Eastern Europe
try it yourself in overpass-turbo
area[name="XX"]->.a; // UA, EE, etc.
node["landuse"="cemetery"](area.a);
out skel;
3 Convert areas from picnic table to picnic site
try it yourself in overpass-turbo
way["leisure"="picnic_table"][amenity!=shelter];
out body geom;
4 Add brand tags for Burger King in Western Europe
try it yourself in overpass-turbo
(
  node[name="Burger King"][!"brand:wikidata"](36,-11,69,15);
  way[name="Burger King"][!"brand:wikidata"](36,-11,69,15);
);
out body geom;

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
try it yourself in overpass-turbo
(
  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
try it yourself in overpass-turbo
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

Step 1 Step 2 Step 3
try it yourself in overpass-turbo
area[name="France"]->.a;
node[natural=peak][wikidata][!ele](area.a);
out meta;

Then open data in JOSM and get all the wikidata tags values

Extract peaks elevation from wikidata:
var tab  = ["Q11941562","Q17485163",]; // PUT ALL THE WIKIDATA IDS HERE
var res = {};
var baseUrl = 'https://www.wikidata.org/wiki/Special:EntityData/';
var endUrl = '.json';

var getJSON = function(url, wd, callback) {
  var xhr = new XMLHttpRequest();
  xhr.open('GET', url, true);
  xhr.responseType = 'json';
  xhr.onload = function() {
    var status = xhr.status;
    if (status === 200) {
      callback(xhr.response, wd);
    }
  };
  xhr.send();
};

for(var i = 0; i < tab.length; i++) {
  var wd = tab[i];
  var url = baseUrl + wd + endUrl;
  getJSON(url, wd, function(data, wd) {
    var P2044 = data.entities[wd].claims.P2044;
    if (P2044) {
      var ele = P2044['0'].mainsnak.datavalue.value.amount
      if (ele) {
        ele = ele.replace('+', '');
        res[wd] = ele;
      }
    }
  });
};

function printRes(){
  console.log(JSON.stringify(res));
}
Run this script in the console of your web browser and run it. Wait a bit, then type the command printRes().

Copy the JSON object printed in console.

Run the following script in JOSM:

var layer = josm.layers.get("peak-wikidata.osm");
var ds = layer.data;

var data = {"Q21027404":"1609","Q11941562":"2313.8"}; // COPY THE JSON OBJECT HERE

ds.each(function(n) {
  var wd = n.tags.wikidata;
  var ele = data[wd];
  n.tags.ele = ele;
});

josm.alert("End of script");

Run the script in JOSM. Save the layer peak-wikidata.osm, then run the following command in bash:

mr cooperative tag peak-wikidata.osm --out peak-wikidata.geojson

Metropolitan France areas

try it yourself in overpass-turbo
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;

Performances

try it yourself in overpass-turbo
[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
try it yourself in overpass-turbo
[out:json];
area[name="France métropolitaine"]->.a;
nw[name="KFC"](area.a);
out body geom;
// Take 24 seconds but contains also Corsica
try it yourself in overpass-turbo
// 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
try it yourself in overpass-turbo
[out:json];
area["ISO3166-2"="FR-ARA"]->.ARA; // Auvergne-Rhône-Alpes
nw[name="KFC"](area.ARA);
out body geom;
// Take 40 seconds

Overseas France areas

try it yourself in overpass-turbo
// 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;

European countries areas

try it yourself in overpass-turbo
//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

Tips

Description Query
Search in multiple area.

You can join multiple places in a single area.

try it yourself in overpass-turbo
(
  area[name="Mariac"];
  area[name="Accons"];
)->.a;
nw[amenity](area.a);
out geom;
Search for a given value for any key
try it yourself in overpass-turbo
area[name="Mariac"]->.a;
nw[~".*"~"Dorne"](area.a);
out geom;
Search for a given value for any key

^ starting or $ ending with specific char

try it yourself in overpass-turbo
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

try it yourself in overpass-turbo
area[name="Mariac"]->.a;
nw["name"~"église∣école",i](area.a);
out geom;
Convert a way or rel to an area
try it yourself in overpass-turbo
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
try it yourself in overpass-turbo
area[name="Mariac"]->.a;
rel(pivot.a);
out geom;
I want a picnic table near drinking water and shelter
try it yourself in overpass-turbo
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
try it yourself in overpass-turbo
area[name="Grenoble-Alpes Métropole"]->.a;
(
  node(area.a)(user:Binnette);
  way (area.a)(user:Binnette);
);
out geom;
My edits in Mariac
try it yourself in overpass-turbo
area[name="Mariac"]->.a;
nwr(area.a)(user:Binnette);
out geom;

Bornes de recharges pour véhicules électriques en Ardèche

try it yourself in overpass-turbo
area["ISO3166-2"="FR-07"]->.a;
(
  node["amenity"="charging_station"](area.a);
  way["amenity"="charging_station"](area.a);
);
out body;
>;
out skel qt;

Campings en Ardèche

try it yourself in overpass-turbo
area["ISO3166-2"="FR-07"]->.a;
(
  node["tourism"="camp_site"](area.a);
  way["tourism"="camp_site"](area.a);
);
out body;
>;
out meta qt;