Overpass turbo/Extended Overpass Queries

From OpenStreetMap Wiki
Jump to: navigation, search
Available languages — Overpass turbo/Extended Overpass Queries
English français 日本語

Overpass turbo uses an extended Overpass queries in several cases: this provides handy shortcuts for frequently used pieces of code like the {{bbox}} of the map. These extensions do also allow additional data and/or settings to be provided for each query, like a MapCSS {{style}}-sheet for example.

Such extensions are always added to the regular Overpass query by a mustache-template, which begins with two opening curly braces {{ and end with its counterpart }}.

Available Shortcuts

shortcut description example replaced with
(XML-query) (OverpassQL)
{{bbox}} Is replaced with the bounding box coordinates of the current map view-port. {{bbox}} s="48…" w="16…" n="49…" e="17…" 48…,16…,49…,17…
{{center}} Is replaced with the center coordinates of the current map view-port. {{center}} lat="48…" lon="16…" 48…,16…
{{date:string}} Is replaced with the ISO 8601 date-time-string of a relative date in the past. For example, {{date:1 day}} is replaced with the timestamp 24 hours ago. Allowed time units are: second(s), minute(s), hour(s), day(s), week(s), month(s) and year(s). {{date:1 day}} 2013-11-24T22:55:36.201Z
{{geocodeId:name}} Is replaced with the OSM-ID of the first result of a geographical search (e.g. via Nominatim) of the name. {{geocodeId: Vienna}} type="relation" ref="1645…" relation(1645…)
{{geocodeArea:name}} Is replaced with the Overpass-Area-ID of the first result of a geographical search (e.g. via Nominatim) of the name. {{geocodeArea: Vienna}} type="area" ref="3601645…" area(3601645…)
{{geocodeBbox:name}} Is replaced with the bbox of the first result of a geographical search (e.g. via Nominatim) of the name. {{geocodeBbox: Vienna}} s="48…" w="16…" n="49…" e="17…" 48…,16…,49…,17…
{{geocodeCoords:name}} Is replaced with the (centroid) coordinates of the first result of a geographical search (e.g. via Nominatim) of the name. {{geocodeCoords: Vienna}} lat="48…" lon="16…" 48…,16…

Custom Shortcuts

One can also define custom shortcuts by putting {{shortcut=value}} somewhere in the script. Then every occurrence of {{shortcut}} is replaced by its value.

Other Extensions

shortcut description example
{{style:…}} Specifies a MapCSS stylesheet. See this subpage for more info. {{style:
  line[highway=path] {color: red;}
}}
{{data:…}} Allows to specify a data-source. A data-source has a data-mode and optionally some options. Currently, the only supported data-mode is overpass (and it's only option is the parameter server which gives the respective Overpass API server to use). {{data:overpass,server=http://overpass-api.de/api/}}