Difference between revisions of "Overpass templates"
Jump to navigation
Jump to search
m |
m |
||
| (8 intermediate revisions by the same user not shown) | |||
| Line 4: | Line 4: | ||
==Elements== | ==Elements== | ||
| + | ===URL-encoding=== | ||
{| class="wikitable" | {| class="wikitable" | ||
|<pre>' '</pre> | |<pre>' '</pre> | ||
| Line 13: | Line 14: | ||
|<pre>;</pre> | |<pre>;</pre> | ||
|<pre>!</pre> | |<pre>!</pre> | ||
| + | |<pre>|</pre> | ||
|<pre>line break</pre> | |<pre>line break</pre> | ||
|<pre>space</pre> | |<pre>space</pre> | ||
|<pre>"</pre> | |<pre>"</pre> | ||
|<pre>></pre> | |<pre>></pre> | ||
| + | |<pre>$</pre> | ||
| + | |<pre>x</pre> | ||
| + | |<pre>x</pre> | ||
| + | |<pre>x</pre> | ||
|- | |- | ||
|%20 | |%20 | ||
| Line 26: | Line 32: | ||
|%3B | |%3B | ||
|%21 | |%21 | ||
| + | |%7C | ||
|line break %0A | |line break %0A | ||
|space %20 | |space %20 | ||
|%22 | |%22 | ||
|%3E | |%3E | ||
| + | |%24 | ||
| + | |x | ||
| + | |x | ||
| + | |x | ||
|} | |} | ||
| + | ===d=== | ||
| + | |||
| + | Bounding box | ||
| + | *https://dev.overpass-api.de/overpass-doc/en/full_data/bbox.html | ||
| + | *<pre>([[bbox]])</pre> | ||
==x== | ==x== | ||
| Line 39: | 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 116: | Line 132: | ||
{{Ogfcode | search1 = aeroway/runway | exclude1 = ref}} | {{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}} | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | {{#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