Hu:Overpass turbo/Wizard

From OpenStreetMap Wiki
Jump to navigation Jump to search

broom

Help (89606) - The Noun Project.svg

Overpass API logo.svg
edit
Overpass API · Language reference · Language guide · Technical terms · Areas · Query examples · Sparse Editing · Permanent ID · FAQ · több (magyar) · Web site
Servers status · Versions · Fejlesztés · Technical design · Telepítés · XAPI compatibility layer · Public transport sketch lines · Alkalmazások · Source code and issues
Overpass turbo · Varázsló · Overpass turbo shortcuts · MapCSS stylesheets · Export to GeoJSON · több (magyar) · Development · Source code and issues · Web site
Overpass Ultra · Examples · Overpass Ultra extensions · MapLibre stylesheets · URL Params · több (magyar) · Source code and issues · Web site
Látogass el az overpass-turbo.eu oldalra és kövesd a lépéseket:
1. Válaszd ki a Varázslót az eszköztárból!
2. Írd be, mit szeretnél!
3. Nyomd meg a gombot!
4. Élvezd az eredményt!

Cél

Writing Overpass queries can sometimes be a quite tedious, repetitive work that requires knowledge of the Overpass query language in the first place. overpass turbo's Query Wizard helps you by converting simple, human readable search terms into functional Overpass queries. Here is an example: To get drinking water fountains, now all you have to do is fire up the Wizard and type in the appropriate tag amenity=drinking_water, instead of writing down a multi-line Overpass query.

The syntax the Wizard understands is inspired by JOSM's search/filter functions. A search consists of individual filter expressions, for example key=value (for a simple tag search) or type:node (to restrict the result to only nodes). Those can be combined together with logical operations like and or or. Take a look at the following examples:

  • tourism=hotel
  • amenity=drinking_water and type:node
  • (highway=primary or highway=secondary) and type:way

By default, data is searched in the current map viewport. But the Wizard also understands some other location filters. Here is an example of how to search in a certain city:

  • tourism=museum in Vienna


Címkék keresése

selector description
key=value

key==value

Matches objects that have a tag with key key and the value value.
key:valuefragment Matches objects that have a tag with key key and whose value contains the string valuefragment.
key~regex

key~=regex
key like regex

Matches objects that have a tag with key key and whose value matches the regular expression regex.
~keyregex~regex

~keyregex~=regex

Matches objects that have a tag with a key that matches the regular expression keyregex and whose value matches the regular expression regex.
key=*

key==*
key is not null

Matches objects that have a tag with key key.
key!=value

key!==value

Matches objects that do not have a tag with key key and the value value.
key!~regex

key not like value

Matches:
a) objects that have a tag with key key and whose value does not match the regular expression regex
b) objects that do not have a tag with key key
key!=*

key!==*
key is null

Matches objects that do not have a tag with the key key.

If a string (for example the value of one of the tag-selectors above) contains whitespace or other special characters (such as colons, dashes, non-ascii characters, etc.) it must be enclosed in quotes:

  • name="New York"
  • "addr:housenumber" = *

Regular expressions can be provided either as plain strings or with the well known regex notation:

  • ref ~ "[0-9]+"
  • name ~ /street$/i (the modifier i makes the match case-insensitive)

Intelligens varázsló

Instead of tag searches, one can also just filter by object categories. For example one can use the terms Hotel, "Drinking Water", Hospital, etc. instead of the corresponding tags. This works for all objects for which a preset is defined in the iD editor.

Meta-Data szűrők

selector description
type:osm-type Matches objects that have the type osm-type (node, way or relation).
id:osm-id Matches objects that have the id osm-id.
user:osm-user Matches objects that were last modified by user osm-user.
uid:osm-uid Matches objects that were last modified by a user with the user-id osm-uid.
newer:date Matches objects that have been added or modified more recently than date.

The parameter date for the newer selector can be either an ISO 8601 time string (e.g. "2013-11-24T19:01:00Z") or a relative date which indicates the relative amount of time in the past:

  • newer:1day (selects everything that has been added or modified in the last 24 hours)
  • newer:"4 weeks" (selects everything that has been added or modified in the last 4 weeks)

Allowed time units are: second(s), minute(s), hour(s), day(s), week(s), month(s) and year(s).

Hely szerinti szűrők

By default, the Wizard creates queries that search in the current map view-port (via a <bbox-query {{bbox}}/>). By specifying a location filter at the end of the search you can also search in different places or even globally:

selector description
in bbox (default) Matches objects that are inside the current map view-port.
in place Matches objects that are inside an area with the name place.
around place Matches objects that are in the vicinity of an object with the name place.
global Matches objects globally, without any restriction by location. For results falling outside the current view-port, use the Zoom to Data control to locate it.

The place-names mentioned above are passed though a Nominatim search first. That means, you can use any place name that you can also use on OSM's search box, like town names, POIs, addresses, etc.

  • tourism=museum in Vienna
  • amenity=restaurant around "1600 Pennsylvania Ave NW, Washington"
  • tourism=attraction around "Riesenrad, Wien"

Logikai operátorok

operator description
X or Y

X || Y, X | Y

Matches when either the objects that have a tag with key key and the value value.
X and Y

X && Y, X & Y

Matches when either the objects that have a tag with key key and the value value.

All boolean operators can be used with braces to change operator priorities:

  • (highway=bus_stop or railway=platform) and shelter=yes

Wizard filled by URL-parameter

You can create links to overpass turbo that use the query wizard to create a query (which is loaded on startup and presentet to the user). An example is http://overpass-turbo.eu/?w=pub+in+dublin. Such URLs to overpass turbo are both quite short and at least somewhat human readable.

By appending &R to this link, the query will be executed immediately and query results are shown on the map. Example: http://overpass-turbo.eu/?w=pub+in+dublin&R

This feature is also utilized by the search engine DuckDuckGo: You can simply type your query in their search box accompanied by !otw (which stands for "Overpass Turbo Wizard") and when starting the search you are immediately taken to the overpass turbo page with the query you entered.

Használhatsz helyettesítő karaktereket is

You would like to see all ham-radio repeater in a certain region in Germany. The callsigns of the ham-radio repeater in Germany start all with: DB0* examples: DB0XS, DB0SR ... and the callsigns are located in the name tag.

Solution: Use this regular expression: name~"^DB0.*".

So far, when searching for a tag that consists of key=value, wildcards are only possible when defining the value of a tag, you cannot apply any wildcard to the key. Feature to search also for a key via regex is available now, see above.

Kifutás az időből

By default, [timeout:25] is part of the query. It means that query will be stopped after running for 25 seconds. In some situations one may wish to increase this value to allow querries to run for a longer time.

Korlátozások

With in-browser use of Overpass turbo Wizard it is impossible to cause too much traffic on servers (except deliberately malicious use). See Overpass_API#Introduction ("You can safely assume...")

Technikai részletek

The wizard defines its own grammar (written in PEG.js, a simple parser generator for JavaScript). The parsed query (a tree of boolean operations and filters) is then normalized into disjunctive normal form (A∧B∧…) ∨ (X∧Y∧…) ∨ … which is much easier to represent as an Overpass query (i.e. a simple union of queries). After that, an annotated Overpass QL query is constructed quite trivially. For some filters special query-shortcuts (such as {{geocodeArea:*}} for an … in Area search) are used.