<beginfold id='1'>/*</beginfold id='1'> Overpass samples taken from
   https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL
   https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example

<endfold id='1'>*/</endfold id='1'>

// single line comment with TODO alerts

<beginfold id='1'>/*</beginfold id='1'> multi-line comment with ### alerts <endfold id='1'>*/</endfold id='1'>

[out:json][timeout:25];
// gather results
<beginfold id='2'>(</beginfold id='2'>
  // query part for: “amenity=post_box”
  node["amenity"="post_box"]<beginfold id='2'>(</beginfold id='2'>52.0, 13.0, 54.0, 13.5<endfold id='2'>)</endfold id='2'>;
  way["amenity"="post_box"]<beginfold id='2'>(</beginfold id='2'>{{bbox}}<endfold id='2'>)</endfold id='2'>;
  relation["amenity"="post_box"]<beginfold id='2'>(</beginfold id='2'>{{bbox}}<endfold id='2'>)</endfold id='2'>;
<endfold id='2'>)</endfold id='2'>;
// print results
out body;
>;
out skel qt;


[out:csv<beginfold id='2'>(</beginfold id='2'>::type, "de:regionalschluessel", name,
         ::count, ::"count:nodes", ::"count:ways", ::"count:relations"<endfold id='2'>)</endfold id='2'>];

//All areas with regional key (German: "Regionalschlüssel") starting with 057
area["de:regionalschluessel"~"^057"];

// Count the pharmacies in each area
foreach->.regio<beginfold id='2'>(</beginfold id='2'>
  // display details for the current area
  .regio out;

  // Collect all Nodes, Ways and Relations with amenity=pharmacy in the current area
  <beginfold id='2'>(</beginfold id='2'> node<beginfold id='2'>(</beginfold id='2'>area.regio<endfold id='2'>)</endfold id='2'>[amenity=pharmacy];
    way<beginfold id='2'>(</beginfold id='2'>area.regio<endfold id='2'>)</endfold id='2'>[amenity=pharmacy];
    rel<beginfold id='2'>(</beginfold id='2'>area.regio<endfold id='2'>)</endfold id='2'>[amenity=pharmacy];<endfold id='2'>)</endfold id='2'>;

// Count the elements in the current area Area
  out count;
<endfold id='2'>)</endfold id='2'>;


[timeout:300]
[bbox:51.08282186160976,-12.8759765625,55.986091533808384,-1.86767578125]
[out:csv<beginfold id='2'>(</beginfold id='2'>::id, ::type, name, "name:en", "name:ga"<endfold id='2'>)</endfold id='2'>];

<beginfold id='2'>(</beginfold id='2'> node[name]["name:en"]["name:ga"]<beginfold id='2'>(</beginfold id='2'>if:<beginfold id='2'>(</beginfold id='2'>t["name"] != t["name:en"]<endfold id='2'>)</endfold id='2'> && <beginfold id='2'>(</beginfold id='2'>t["name"] != t["name:ga"]<endfold id='2'>)</endfold id='2'><endfold id='2'>)</endfold id='2'>;
  way[name]["name:en"]["name:ga"] <beginfold id='2'>(</beginfold id='2'>if:<beginfold id='2'>(</beginfold id='2'>t["name"] != t["name:en"]<endfold id='2'>)</endfold id='2'> && <beginfold id='2'>(</beginfold id='2'>t["name"] != t["name:ga"]<endfold id='2'>)</endfold id='2'><endfold id='2'>)</endfold id='2'>;
  rel[name]["name:en"]["name:ga"] <beginfold id='2'>(</beginfold id='2'>if:<beginfold id='2'>(</beginfold id='2'>t["name"] != t["name:en"]<endfold id='2'>)</endfold id='2'> && <beginfold id='2'>(</beginfold id='2'>t["name"] != t["name:ga"]<endfold id='2'>)</endfold id='2'><endfold id='2'>)</endfold id='2'>;
<endfold id='2'>)</endfold id='2'>;
out;


[out:csv<beginfold id='2'>(</beginfold id='2'>version,timestamp,changeset,count<endfold id='2'>)</endfold id='2'>];
timeline<beginfold id='2'>(</beginfold id='2'>relation,2632934<endfold id='2'>)</endfold id='2'>;
for <beginfold id='2'>(</beginfold id='2'>t["created"]<endfold id='2'>)</endfold id='2'>
{
  retro<beginfold id='2'>(</beginfold id='2'>_.val<endfold id='2'>)</endfold id='2'>
  {
    rel<beginfold id='2'>(</beginfold id='2'>2632934<endfold id='2'>)</endfold id='2'>;
    make stat version=u<beginfold id='2'>(</beginfold id='2'>version<beginfold id='2'>(</beginfold id='2'><endfold id='2'>)</endfold id='2'><endfold id='2'>)</endfold id='2'>,timestamp=u<beginfold id='2'>(</beginfold id='2'>timestamp<beginfold id='2'>(</beginfold id='2'><endfold id='2'>)</endfold id='2'><endfold id='2'>)</endfold id='2'>,changeset=u<beginfold id='2'>(</beginfold id='2'>changeset<beginfold id='2'>(</beginfold id='2'><endfold id='2'>)</endfold id='2'><endfold id='2'>)</endfold id='2'>,count=u<beginfold id='2'>(</beginfold id='2'>count_members<beginfold id='2'>(</beginfold id='2'><endfold id='2'>)</endfold id='2'><endfold id='2'>)</endfold id='2'>;
    out;
  }
}


[timeout:60];
area["name"="Mayenne"]->.boundaryarea;
way<beginfold id='2'>(</beginfold id='2'>area.boundaryarea<endfold id='2'>)</endfold id='2'>["building"="church"];
  foreach<beginfold id='2'>(</beginfold id='2'>
    node<beginfold id='2'>(</beginfold id='2'>w<endfold id='2'>)</endfold id='2'>->.d;                                     // determine all nodes of a way
    .n is_in->.a;
    area.a[name][boundary=administrative][admin_level~"^[2-8]$"] -> .a;
    out center;
    convert way ::=::,
              ::id = id<beginfold id='2'>(</beginfold id='2'><endfold id='2'>)</endfold id='2'>,
              is_in=a.set<beginfold id='2'>(</beginfold id='2'>"{" + t["admin_level"] + ":" + t["name"] + "}"<endfold id='2'>)</endfold id='2'>;

    out;
<endfold id='2'>)</endfold id='2'>;
