Overpass turbo/Extended Overpass Turbo Queries

From OpenStreetMap Wiki
Jump to: navigation, search
Available languages — Overpass turbo/Extended Overpass Turbo 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.

These extensions are specific to the overpass turbo interface and take precedence over the Overpass QL syntax (i.e. they are evaluated directly in the browser and not sent to the Overpass API). They are written inline any overpass query, delimited from it by double curly braces (beginning with {{ and ending 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 its only option is the parameter server which gives the respective Overpass API server to use). {{data:overpass,server=http://overpass-api.de/api/}}