Template:OverpassTurboExample

From OpenStreetMap Wiki
Jump to: navigation, search
[Edit] [Octicons-sync.svgpurge] Template-info.svg Template documentation

Introduction

Template to generate overpass turbo examples for Wiki pages.

Features:

  • display Overpass query source code in a source code box as-is
  • adds a small Overpass Turbo icon to the upper right corner of the source code box. This icon directly links Overpass turbo without having to create dedicated overpass turbo sharelinks in the first place.

Please write to User:mmd, if you have any suggestions or questions to this template.


Usage

Parameter Description Additional hints
Required parameter
query Overpass QL or Overpass XML query Note : overpass turbo shortcuts needs to be properly escaped via {{((}}bbox{{))}}, any "|" (pipe) character in regular expression needs be rewritten as {{!}}
Optional parameter
loc Map Location & Zoom as defined for overpass turbo. Only provide lat/lon/zoom level for parameter loc. Example: loc=47.0618984;15.4370248;17

Examples

{{OverpassTurboExample|query=
  node({{((}}bbox{{))}})[place=village];
  foreach(
    is_in->.a;
    area.a[name][boundary=administrative][admin_level~"^[2-8]$"] -> .a;
    convert node ::=::,
              ::id = id(),
              is_in=a.set("{" + t[admin_level] + ":" + t[name] + "}");
   
    out;
  );
}}

Set the map viewport to New York by using the loc parameter:

{{OverpassTurboExample|loc=40.7553;-73.9638;13|query=
[bbox:{{((}}bbox{{))}}];
way[highway][name="6th Avenue"];node(w)->.n1;
way[highway][name="West 23rd Street"];node(w)->.n2;
node.n1.n2;
out meta;
}}

See also