Overpass turbo/Extended Overpass Turbo Queries

From OpenStreetMap Wiki
Jump to navigation Jump to search
Overpass API logo.svg
edit
Overpass API · Language reference · Language guide · Technical terms · Areas · Query examples · Sparse Editing · Permanent ID · FAQ · more · Web site
Servers status · Versions · Development · Technical design · Installation · XAPI compatibility layer · Public transport sketch lines · Applications · Source code and issues
Overpass turbo · Wizard · Overpass turbo shortcuts · MapCSS stylesheets · Export to GeoJSON · more · Development · Source code and issues · Web site
Overpass Ultra · Examples · Overpass Ultra extensions · MapLibre stylesheets · URL Params · more · Source code and issues · Web site

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 in any overpass query, delimited from it by double curly braces (beginning with {{ and ending with its counterpart }}).

Here you can find detailed examples of overpass turbo queries: Overpass API/Overpass API by Example - OpenStreetMap Wiki

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). In a typical OverpassQL query, use this shortcut enclosed in quotation marks, see this example. When used without any parameter, the current time is returned. {{date:1 day}}
{{date}}
2018-02-16T10:56:36.440Z
2018-02-17T10:56:36.440Z
{{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/}}