1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>highlight.overpassql</title>
<meta name="generator" content="KF5::SyntaxHighlighting - Definition (Overpass QL) - Theme (Breeze Light)"/>
</head><body style="background-color:#ffffff;color:#1f1c1b"><pre>
<span style="color:#898887">/* Overpass samples taken from</span>
<span style="color:#898887"> https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL</span>
<span style="color:#898887"> https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example</span>
*/
<span style="color:#898887">// single line comment with </span><span style="color:#ca9219;background-color:#451e1a;font-weight:bold">TODO</span><span style="color:#898887"> alerts</span>
<span style="color:#898887">/* multi-line comment with </span><span style="color:#81ca2d;background-color:#f7e6e6;font-weight:bold">###</span><span style="color:#898887"> alerts </span>*/
[<span style="color:#644a9b">out</span>:json][<span style="color:#0057ae">timeout</span>:<span style="color:#b08000">25</span>];
<span style="color:#898887">// gather results</span>
(
<span style="color:#898887">// query part for: “amenity=post_box”</span>
<span style="color:#644a9b">node</span>[<span style="color:#bf0303">"amenity"</span>=<span style="color:#bf0303">"post_box"</span>](<span style="color:#b08000">52.0</span>, <span style="color:#b08000">13.0</span>, <span style="color:#b08000">54.0</span>, <span style="color:#b08000">13.5</span>);
<span style="color:#644a9b">way</span>[<span style="color:#bf0303">"amenity"</span>=<span style="color:#bf0303">"post_box"</span>](<span style="color:#006e28">{{bbox}}</span>);
<span style="color:#644a9b">relation</span>[<span style="color:#bf0303">"amenity"</span>=<span style="color:#bf0303">"post_box"</span>](<span style="color:#006e28">{{bbox}}</span>);
);
<span style="color:#898887">// print results</span>
<span style="color:#644a9b">out</span> <span style="color:#644a9b;font-weight:bold">body</span>;
>;
<span style="color:#644a9b">out</span> <span style="color:#644a9b;font-weight:bold">skel</span> <span style="color:#644a9b;font-weight:bold">qt</span>;
[<span style="color:#644a9b">out</span>:csv(::<span style="color:#644a9b;font-weight:bold">type</span>, <span style="color:#bf0303">"de:regionalschluessel"</span>, name,
::<span style="color:#644a9b;font-weight:bold">count</span>, ::<span style="color:#bf0303">"count:nodes"</span>, ::<span style="color:#bf0303">"count:ways"</span>, ::<span style="color:#bf0303">"count:relations"</span>)];
<span style="color:#898887">//All areas with regional key (German: "Regionalschlüssel") starting with 057</span>
<span style="color:#644a9b">area</span>[<span style="color:#bf0303">"de:regionalschluessel"</span>~<span style="color:#bf0303">"^057"</span>];
<span style="color:#898887">// Count the pharmacies in each area</span>
<span style="font-weight:bold">foreach</span>->.regio(
<span style="color:#898887">// display details for the current area</span>
.regio <span style="color:#644a9b">out</span>;
<span style="color:#898887">// Collect all Nodes, Ways and Relations with amenity=pharmacy in the current area</span>
( <span style="color:#644a9b">node</span>(<span style="color:#644a9b">area</span>.regio)[amenity=pharmacy];
<span style="color:#644a9b">way</span>(<span style="color:#644a9b">area</span>.regio)[amenity=pharmacy];
<span style="color:#644a9b">rel</span>(<span style="color:#644a9b">area</span>.regio)[amenity=pharmacy];);
<span style="color:#898887">// Count the elements in the current area Area</span>
<span style="color:#644a9b">out</span> <span style="color:#644a9b;font-weight:bold">count</span>;
);
[<span style="color:#0057ae">timeout</span>:<span style="color:#b08000">300</span>]
[<span style="color:#0057ae">bbox</span>:<span style="color:#b08000">51.08282186160976</span>,-<span style="color:#b08000">12.8759765625</span>,<span style="color:#b08000">55.986091533808384</span>,-<span style="color:#b08000">1.86767578125</span>]
[<span style="color:#644a9b">out</span>:csv(::<span style="color:#644a9b;font-weight:bold">id</span>, ::<span style="color:#644a9b;font-weight:bold">type</span>, name, <span style="color:#bf0303">"name:en"</span>, <span style="color:#bf0303">"name:ga"</span>)];
( <span style="color:#644a9b">node</span>[name][<span style="color:#bf0303">"name:en"</span>][<span style="color:#bf0303">"name:ga"</span>](<span style="font-weight:bold">if</span>:(t[<span style="color:#bf0303">"name"</span>] != t[<span style="color:#bf0303">"name:en"</span>]) && (t[<span style="color:#bf0303">"name"</span>] != t[<span style="color:#bf0303">"name:ga"</span>]));
<span style="color:#644a9b">way</span>[name][<span style="color:#bf0303">"name:en"</span>][<span style="color:#bf0303">"name:ga"</span>] (<span style="font-weight:bold">if</span>:(t[<span style="color:#bf0303">"name"</span>] != t[<span style="color:#bf0303">"name:en"</span>]) && (t[<span style="color:#bf0303">"name"</span>] != t[<span style="color:#bf0303">"name:ga"</span>]));
<span style="color:#644a9b">rel</span>[name][<span style="color:#bf0303">"name:en"</span>][<span style="color:#bf0303">"name:ga"</span>] (<span style="font-weight:bold">if</span>:(t[<span style="color:#bf0303">"name"</span>] != t[<span style="color:#bf0303">"name:en"</span>]) && (t[<span style="color:#bf0303">"name"</span>] != t[<span style="color:#bf0303">"name:ga"</span>]));
);
<span style="color:#644a9b">out</span>;
[<span style="color:#644a9b">out</span>:csv(<span style="color:#644a9b;font-weight:bold">version</span>,<span style="color:#644a9b;font-weight:bold">timestamp</span>,<span style="color:#644a9b;font-weight:bold">changeset</span>,<span style="color:#644a9b;font-weight:bold">count</span>)];
<span style="color:#644a9b">timeline</span>(<span style="color:#644a9b">relation</span>,<span style="color:#b08000">2632934</span>);
<span style="font-weight:bold">for</span> (t[<span style="color:#bf0303">"created"</span>])
{
<span style="font-weight:bold">retro</span>(_.val)
{
<span style="color:#644a9b">rel</span>(<span style="color:#b08000">2632934</span>);
<span style="color:#644a9b">make</span> stat <span style="color:#644a9b;font-weight:bold">version</span>=u(<span style="color:#644a9b;font-weight:bold">version</span>()),<span style="color:#644a9b;font-weight:bold">timestamp</span>=u(<span style="color:#644a9b;font-weight:bold">timestamp</span>()),<span style="color:#644a9b;font-weight:bold">changeset</span>=u(<span style="color:#644a9b;font-weight:bold">changeset</span>()),<span style="color:#644a9b;font-weight:bold">count</span>=u(<span style="color:#644a9b;font-weight:bold">count_members</span>());
<span style="color:#644a9b">out</span>;
}
}
[<span style="color:#0057ae">timeout</span>:<span style="color:#b08000">60</span>];
<span style="color:#644a9b">area</span>[<span style="color:#bf0303">"name"</span>=<span style="color:#bf0303">"Mayenne"</span>]->.boundaryarea;
<span style="color:#644a9b">way</span>(<span style="color:#644a9b">area</span>.boundaryarea)[<span style="color:#bf0303">"building"</span>=<span style="color:#bf0303">"church"</span>];
<span style="font-weight:bold">foreach</span>(
<span style="color:#644a9b">node</span>(w)->.d; <span style="color:#898887">// determine all nodes of a way</span>
.n <span style="color:#644a9b">is_in</span>->.a;
<span style="color:#644a9b">area</span>.a[name][boundary=administrative][admin_level~<span style="color:#bf0303">"^[2-8]$"</span>] -> .a;
<span style="color:#644a9b">out</span> <span style="color:#644a9b;font-weight:bold">center</span>;
<span style="color:#644a9b">convert</span> <span style="color:#644a9b">way</span> ::=::,
::<span style="color:#644a9b;font-weight:bold">id</span> = <span style="color:#644a9b;font-weight:bold">id</span>(),
<span style="color:#644a9b">is_in</span>=a.<span style="color:#644a9b;font-weight:bold">set</span>(<span style="color:#bf0303">"{"</span> + t[<span style="color:#bf0303">"admin_level"</span>] + <span style="color:#bf0303">":"</span> + t[<span style="color:#bf0303">"name"</span>] + <span style="color:#bf0303">"}"</span>);
<span style="color:#644a9b">out</span>;
);
</pre></body></html>
|