Template:Overpass turbo example/doc

From OpenStreetMap Wiki
Jump to navigation Jump to search

Introduction

Use overpass turbo ⟶ Export ⟶ section Queryosm wikidownload or copy to create a query with special wiki syntax.

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;
}}

TemplateData

This template will create an Overpass API example query, which is presented on a wiki page with syntax highlighting and a direct link to test and execute the query in overpass turbo.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Overpass API query with overpass turbo extensionsquery 1

Use overpass turbo --> Export --> Query --> download/copy as osm wiki to create a query with special wiki syntax. To update an existing query, load the respective query first into overpass turbo, apply the changes, and export the query in wiki syntax in the same way.

Stringrequired
Location informationloc 2

lat;lon;zoom level

Stringoptional
runrun 3

Automatically execute query in overpass turbo

Booleanoptional
syntax highlight langlang

xml -> xml; ql -> c/cpp; json -> json

Unknownoptional
Endpointendpoint

URL to Overpass turbo

Default
https://overpass-turbo.eu
Example
https://openhistoricalmap.github.io/overpass-turbo
Unknownoptional
collapsedcollapsed

no description

Unknownoptional

See also