Debian Codegraph @

autotests/input/highlight.overpassql

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