Difference between revisions of "Overpass templates"
m (→d) |
|||
| Line 122: | Line 122: | ||
{{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.ogf.rent-a-planet.com/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.ogf.rent-a-planet.com/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://ogfoverpass.rent-a-planet.com/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.ogf.rent-a-planet.com/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}} | ||
| + | }} | ||
| + | |}--> | ||
Revision as of 18:09, 31 January 2023
Elements
Parser
' ' |
[ |
] |
= |
{{
|
}} |
; |
! |
line break |
space |
" |
> |
| %20 | %5B | %5D | %3D | %7B%7B | %7D%7D | %3B | %21 | line break %0A | space %20 | %22 | %3E |
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
Error while fetching data from URL https://overpass.ogf.rent-a-planet.com/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: $2.
Error fetching URL: Could not resolve host: overpass.ogf.rent-a-planet.com
There was a problem during the HTTP request: 0 Error
Could not get URL https://overpass.ogf.rent-a-planet.com/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 after 3 tries.
| Name | Length (km) |
Drains into |
|---|
| Name | Length (km) |
Drains into |
|---|
}}ii6
uu
count=/osm/count/@total
count=/osm/count/tag[@k='total']/@v