Difference between revisions of "Overpass templates"
Jump to navigation
Jump to search
m (→Examples) |
m |
||
| (10 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
| + | ==Elements== | ||
| + | ===URL-encoding=== | ||
| + | {| class="wikitable" | ||
| + | |<pre>' '</pre> | ||
| + | |<pre>[</pre> | ||
| + | |<pre>]</pre> | ||
| + | |<pre>=</pre> | ||
| + | |<pre>{{</pre> | ||
| + | |<pre>}}</pre> | ||
| + | |<pre>;</pre> | ||
| + | |<pre>!</pre> | ||
| + | |<pre>|</pre> | ||
| + | |<pre>line break</pre> | ||
| + | |<pre>space</pre> | ||
| + | |<pre>"</pre> | ||
| + | |<pre>></pre> | ||
| + | |<pre>$</pre> | ||
| + | |<pre>x</pre> | ||
| + | |<pre>x</pre> | ||
| + | |<pre>x</pre> | ||
| + | |- | ||
| + | |%20 | ||
| + | |%5B | ||
| + | |%5D | ||
| + | |%3D | ||
| + | |%7B%7B | ||
| + | |%7D%7D | ||
| + | |%3B | ||
| + | |%21 | ||
| + | |%7C | ||
| + | |line break %0A | ||
| + | |space %20 | ||
| + | |%22 | ||
| + | |%3E | ||
| + | |%24 | ||
| + | |x | ||
| + | |x | ||
| + | |x | ||
| + | |} | ||
| + | ===d=== | ||
| + | Bounding box | ||
| + | *https://dev.overpass-api.de/overpass-doc/en/full_data/bbox.html | ||
| + | *<pre>([[bbox]])</pre> | ||
| + | |||
| + | ==x== | ||
2314028892 | 2314028892 | ||
| Line 10: | Line 55: | ||
http://overpass.osm.rambler.ru/cgi/interpreter?data=%28way[tourism~hotel]%28around:5000,50.10707,8.76040%29%29;out; | http://overpass.osm.rambler.ru/cgi/interpreter?data=%28way[tourism~hotel]%28around:5000,50.10707,8.76040%29%29;out; | ||
103498433 | 103498433 | ||
| − | [https:// | + | [https://overpass.opengeofiction.net/?Q=node(2314028892)%3Bout] |
<!-- Please DO NOT EDIT! Please contact User:Mstr for any edits! | <!-- Please DO NOT EDIT! Please contact User:Mstr for any edits! | ||
<includeonly>{{#if:{{{search1|}}} | | <includeonly>{{#if:{{{search1|}}} | | ||
| − | {{#clear_external_data:}}{{#get_web_data:url=https:// | + | {{#clear_external_data:}}{{#get_web_data:url=https://overpass.opengeofiction.net/api/interpreter?data={{#if:{{{area|}}} | |
{{#ifeq:{{{area}}} | MER | | {{#ifeq:{{{area}}} | MER | | ||
(area%5B%22admin_level%22=2%5D%5B%22name%22=%22Merganien%22%5D;)-%3E.bndarea;%0A | (area%5B%22admin_level%22%5D%5B%22name%22=%22{{{area}}}%22%5D;)-%3E.bndarea;%0A }} }}(node{{#if:{{{area|}}} | | (area%5B%22admin_level%22=2%5D%5B%22name%22=%22Merganien%22%5D;)-%3E.bndarea;%0A | (area%5B%22admin_level%22%5D%5B%22name%22=%22{{{area}}}%22%5D;)-%3E.bndarea;%0A }} }}(node{{#if:{{{area|}}} | | ||
| Line 47: | Line 92: | ||
| + | <!-- | ||
| + | |||
| + | {{#if: {{#titleparts: aa/bb |1|1}} | a | b }} | ||
| + | {{#if: {{#titleparts: aa/ |1|1}} | a | b }} | ||
| + | {{#if: {{#titleparts: aa |1|1}} | a | b }} | ||
| + | {{#if: {{#titleparts: |1|1}} | a | b }} | ||
| + | {{#if: {{#titleparts: aa/bb |2|2}} | a | b }} | ||
| + | {{#if: {{#titleparts: aa/ |2|2}} | a | b }} | ||
| + | {{#if: {{#titleparts: aa |2|2}} | a | b }} | ||
| + | {{#if: {{#titleparts: |2|2}} | a | b }} | ||
| + | |||
| + | node%5Brailway%3Dstation%5D(%7B%7Bbbox%7D%7D)%3Bout%3B&C=45.52944%3B131.26465%3B6&R query]] }} | ||
| + | {{#titleparts:{{{route}}}|1|1}} | ||
| + | way[highway=primary]({{bbox}});/*added by auto repair*/(._;>;);/*end of auto repair*/out; | ||
| + | (node["amenity"="childcare"]({{bbox}});way["amenity"="childcare"]({{bbox}});relation["amenity"="childcare"]({{bbox}}););out body;>;out skel qt; | ||
| + | https://osm3s.opengeofiction.net/overpass-turbo/?Q=%2F*%0AThis%20has%20been%20generated%20by%20the%20overpass-turbo%20wizard.%0AThe%20original%20search%20was%3A%0A%E2%80%9C%22%22%E2%80%9D%0A*%2F%0A%5Bout%3Ajson%5D%5Btimeout%3A25%5D%3B%0A%2F%2F%20gather%20results%0A(%0A%20%20%2F%2F%20query%20part%20for%3A%20%E2%80%9C%22%22%E2%80%9D%0A%20%20node%5B%22amenity%22%3D%22childcare%22%5D(%7B%7Bbbox%7D%7D)%3B%0A%20%20way%5B%22amenity%22%3D%22childcare%22%5D(%7B%7Bbbox%7D%7D)%3B%0A%20%20relation%5B%22amenity%22%3D%22childcare%22%5D(%7B%7Bbbox%7D%7D)%3B%0A)%3B%0A%2F%2F%20print%20results%0Aout%20body%3B%0A%3E%3B%0Aout%20skel%20qt%3B&C=-28.61346;159.60938;1 | ||
| + | https://osm3s.opengeofiction.net/overpass-turbo/?Q=%2F*%0AThis%20has%20been%20generated%20by%20the%20overpass-turbo%20wizard.%0AThe%20original%20search%20was%3A%0A%E2%80%9C%22%22%E2%80%9D%0A*%2F%0A%5Bout%3Ajson%5D%5Btimeout%3A25%5D%3B%0A%2F%2F%20gather%20results%0A(%0A%20%20%2F%2F%20query%20part%20for%3A%20%E2%80%9C%22%22%E2%80%9D%0A%20%20node%5B%22amenity%22%3D%22childcare%22%5D(%7B%7Bbbox%7D%7D)%3B%0A%20%20way%5B%22amenity%22%3D%22childcare%22%5D(%7B%7Bbbox%7D%7D)%3B%0A%20%20relation%5B%22amenity%22%3D%22childcare%22%5D(%7B%7Bbbox%7D%7D)%3B%0A)%3B%0A%2F%2F%20print%20results%0Aout%20body%3B%0A%3E%3B%0Aout%20skel%20qt%3B&C=-28.61346;159.60938;1 | ||
| + | --><!-- | ||
| + | [[https://osm3s.opengeofiction.net/overpass-turbo/?Q=node%0A%20%20%5Brailway%3Dstation%5D%0A%20%20(%7B%7Bbbox%7D%7D)%3B%0Aout%3B&C=45.52944;131.26465;6&R query]] | ||
| + | [[https://osm3s.opengeofiction.net/overpass-turbo/?Q=node%5Brailway%3Dstation%5D(%7B%7Bbbox%7D%7D)%3Bout%3B&C=45.52944;131.26465;6&R query]] | ||
| + | [[https://osm3s.opengeofiction.net/overpass-turbo/?Q=node%5Brailway%3Dstation%5D(%7B%7Bbbox%7D%7D)%3Bout%3B&C=45.52944;131.26465;8&R query]] | ||
| + | --> | ||
| + | |||
| + | |||
| + | ==Create overpass code for copy&paste== | ||
| + | |||
| + | |||
| + | {{Ogfcode | search1 = power/line | search2 = voltage/380000 | search3 = frequency/50 | latitude = 45 | longitude = 130 | zoom = 5}} | ||
| + | |||
| + | {{Ogfcode | search1 = railway/rail | search2 = gauge/1435 | latitude = 45 | longitude = 130 | zoom = 5}} | ||
| + | |||
| + | {{Ogfcode | search1 = railway/rail | search2 = voltage/25000 | search3 = frequency/50 | latitude = 45 | longitude = 130 | zoom = 5}} | ||
| + | |||
| + | {{Ogfcode | search1 = aeroway/aerodrome | search2 = icao}} | ||
| + | |||
| + | {{Ogfcode | search1 = aeroway/aerodrome | search2 = iata}} | ||
| + | |||
| + | {{Ogfcode | search1 = aeroway/aerodrome | exclude1 = icao | exclude2 = iata}} | ||
| + | |||
| + | {{Ogfcode | search1 = aeroway/runway | exclude1 = ref}} | ||
| + | |||
| + | ==More tests== | ||
| − | ' ' | + | ===Test count=== |
| + | {{#clear_external_data:}} | ||
| + | {{#get_web_data:url=https://overpass.opengeofiction.net/api/interpreter?data=(area%5Bname%3D%22Guai%22%5D%5B%22admin_level%22%3D%222%22%5D%3B%20)-%3E.a%3B%20relation%5B%22type%22%3D%22waterway%22%5D%5B%22water%22%3D%22river%22%5D%5Bname%5D(area.a)%3Bout%3B | ||
| + | |format=xml | ||
| + | |order by=/osm/relation/tag[@k='name']/@v DESC | ||
| + | |data= | ||
| + | relation_id=/osm/relation/@id | ||
| + | ,name=/osm/relation/tag[@k='name']/@v | ||
| + | ,distance=/osm/relation/tag[@k='distance']/@v | ||
| + | ,destination=/osm/relation/tag[@k='destination']/@v | ||
| + | ,ref=/osm/relation/tag[@k='ref']/@v | ||
| + | |use xpath | ||
| + | }} | ||
| + | {| class="wikitable sortable" | ||
| + | ! Name | ||
| + | ! Length<br/>(km)<br> | ||
| + | ! Drains into | ||
| + | {{#for_external_table:<nowiki/> | ||
| + | {{!}}- | ||
| + | {{!}}[http://opengeofiction.net/relation/{{{relation_id}}} {{{name}}}] | ||
| + | {{!}}{{{distance}}} | ||
| + | {{!}}[[{{{destination}}}]] | ||
| + | }} | ||
| + | |} | ||
| + | {{#clear_external_data:}} | ||
| − | |||
| − | + | {{clear}} | |
| − | |||
| − | |||
| − | |||
| − | ; %3B | + | {{#clear_external_data:}}{{#get_web_data:url=https://overpass.opengeofiction.net/api/interpreter?data=(area%5B%22admin_level%22=2%5D%5B%22name%22=%22Merganien%22%5D;)-%3E.bndarea;%0A(node(area.bndarea)%5B%22highway%22%3D%22motorway%22%5D;way(area.bndarea)%5B%22highway%22%3D%22highway%22%5D;relation(area.bndarea)%5B%22highway%22%3D%22motorway%22%5D%3B)%3B%0Aout%20count%3B%3E%3Bout%20skel%20qt%3B |
| + | |format=xml | ||
| + | |data= | ||
| + | count=/osm/way/tag[@k='highway']/@v | ||
| + | |use xpath}} | ||
| + | {| class="wikitable sortable" | ||
| + | ! Name | ||
| + | ! Length<br/>(km)<br> | ||
| + | ! Drains into | ||
| + | {{#for_external_table:<nowiki/> | ||
| + | {{!}}- | ||
| + | {{!}}{{{count}}} | ||
| + | {{!}}ö | ||
| + | {{!}}l | ||
| + | }} | ||
| + | |} | ||
| + | {{#clear_external_data:}} | ||
| − | |||
| − | |||
| − | + | }}ii{{{count|6}}}{{#for_external_table:{{{count}}} }}{{#clear_external_data:}} | |
| − | |||
| − | + | uu | |
| + | count=/osm/count/@total | ||
| + | count=/osm/count/tag[@k='total']/@v | ||
| − | == | + | <!-- |
| + | ==Overpass testing== | ||
| + | |||
| + | {{#clear_external_data:}} | ||
| + | {{#get_web_data:url=https://overpass.opengeofiction.net/api/interpreter?data=%28area%5B%22admin_level%22%5D%5B%22ogf%3Aid%22%3D%22UL02a%22%5D%3B%29-%3E.bndarea%3B%0A%28nwr%28area.bndarea%29%5Breligion%3D%27christian%27%5D%288.450638800331001%2C29.970703124999996%2C35.96022296929667%2C64.7314453125%29%3B%29%3Bout%20body%3B%3E%3Bout%20skel%20qt%3B | ||
| + | |format=xml | ||
| + | |data= | ||
| + | wname=/osm/way/tag[@k='name']/@v | ||
| + | ,wcity=/osm/way/tag[@k='is_in:city']/@v | ||
| + | ,wid=/osm/way/@id | ||
| + | |use xpath}} | ||
| + | {| class="wikitable sortable" | ||
| + | ! Name | ||
| + | ! City | ||
| + | ! Map | ||
| + | {{#for_external_table:<nowiki/> | ||
| + | {{!}}- | ||
| + | {{!}}{{{wname}}} | ||
| + | {{!}}{{{wcity}}} | ||
| + | {{!}}[http://opengeofiction.net/way/{{{wid}}} (way {{{wid}}})] | ||
| + | }} | ||
| + | |} | ||
| + | |||
| + | |||
| + | ==From wiki== | ||
| + | {{#clear_external_data:}} | ||
| + | {{#get_web_data:url=https://overpass.opengeofiction.net/api/interpreter?data=[maxsize:10000000][timeout:30];area[name="Kojo"];nwr[diplomatic=embassy](area); (._;>;); out; | ||
| + | |format=xml | ||
| + | |data= | ||
| + | node_id=/osm/node/@id | ||
| + | ,name=/osm/node/tag[@k='name']/@v | ||
| + | ,notes=/osm/node/tag[@k='notes']/@v | ||
| + | |use xpath}} | ||
| + | {| class="wikitable sortable mw-collapsible mw-expanded" | ||
| + | ! Name | ||
| + | ! Notes | ||
| + | ! Map | ||
| + | {{#for_external_table: | ||
| + | {{!}} | ||
| + | {{!}}{{{name}}} | ||
| + | {{!}}{{{notes}}} | ||
| + | {{!}}{{node|{{{node_id}}}|Embassy map}} | ||
| + | }} | ||
| + | |}--> | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ==x1== | ||
| + | {{#get_web_data:url=https://overpass.opengeofiction.net/api/interpreter?data=(area%5B%22admin_level%22=2%5D%5B%22name%22=%22Mergania%22%5D;)-%3E.bndarea;%0A(way(area.bndarea)%5B%22aeroway%22%3D%22runway%22%5D%3B)%3B%0Aout%20count%3B | ||
| + | |format=xml | ||
| + | |data= | ||
| + | count=/osm/count/@total | ||
| + | |use xpath | ||
| + | }}{{#for_external_table:{{{count}}} }} | ||
| + | |||
| − | |||
| − | {{ | + | {{#get_web_data:url=https://overpass.opengeofiction.net/api/interpreter?data=(area%5B%22admin_level%22=2%5D%5B%22name%22=%22Mergania%22%5D;)-%3E.bndarea;%0A(way(area.bndarea)%5B%22aeroway%22%3D%22runway%22%5D%3B)%3B%0Amake%20stats%20length=sum(length())%3Bout%3B |
| + | |format=xml | ||
| + | |data= | ||
| + | lngth=/osm/stats/@length | ||
| + | |use xpath | ||
| + | }}{{#for_external_table:{{{lngth}}} }} | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | ==x2== | |
Latest revision as of 22:50, 3 May 2025
Elements
URL-encoding
' ' |
[ |
] |
= |
{{
|
}} |
; |
! |
| |
line break |
space |
" |
> |
$ |
x |
x |
x |
| %20 | %5B | %5D | %3D | %7B%7B | %7D%7D | %3B | %21 | %7C | line break %0A | space %20 | %22 | %3E | %24 | x | x | x |
d
Bounding box
x
2314028892
http://overpass.osm.rambler.ru/cgi/interpreter?data=%28way[tourism~hotel]%28around:5000,50.10707,8.76040%29%29;out; 103498433 [1]
</includeonly>-->
Examples
- Template:MER-opq-length
- Template:MER-opq-countsp
- Template:MER-autoTable rfrsh
- Template:MER-opq-count
- Template:MER-opq-eval
- Template:MER-opq-territorystatistics
- x
- x
- x
- x
- x
Create overpass code for copy&paste
More tests
Test count
| Name | Length (km) |
Drains into |
|---|
}}ii6
uu
count=/osm/count/@total
count=/osm/count/tag[@k='total']/@v