Convert form
MapQL
Please input a sequence of queries or actions. Queries extract data into a set, actions produce some output based on their input set.
A simple example is
node[name="Gielgen"]
{ out meta; }
The action is { out meta; }. The general form of an action is .<input variable>{ out <modifiers>; }. The input variable can be ommited; then it defaults to _. Allowed modifiers are
- ids: Print only the id of each element.
- skel: Print ids, coordinates and memberships.
- body: Print the complete spatial data.
- meta: Print the complete spatial and meta data.
- quirks: Fake the meta data to cope with overzealous parsers. Not yet implemented.
- qt: Order by quadtile instead of id.
- asc: Order printed elements by id.
The default options are body and asc.
The query consists of a type selector node and a clause [name="Gielgen"] to select all elements that have a key "name" with value "Gielgen". In general, a query consists of one of the type specifiers node, way or relation (abbreviated rel), an input variable if applicable, one or more clauses and always an output variable. If the output variable is omitted, it defaults to _. The result sets of the clauses are intersected to produce a result. If an input variable is present, the input set is addtionally intersected with the result.
The input variable is inserted before the first clause, the output variable is appended with an arrow: <type>.<input variable><clauses>->.<output variable>.
The following clauses are possible:
- bbox: written as (south,west,north,east). An example is
node[highway=bus_stop](50.6,6.8,50.9,7.2){out;}
.
- id: written as (ref), where ref is the id of the referred element. An example is
rel(62478){out;}
- has-kv: written as ["key"="value"] or ["key"]. The former selects all elements where the key has the given value, the latter selects all elements where the key has any nonempty value. The quotations marks can be omitted if the entire string contains only alphanumeric characters. Example:
way[name="Adelheidisstraße"]{out;}
.
- recurse: written as (w.input set), (r.input set), (bn.input set), (bw.input set), or (br.input set). Determines the origin from with the given type of elements should be derived. The input set including the leading dot can be omitted. It then default to _. Examples are
way[name="Adelheidisstraße"]node(w){out;}
and way[name="Adelheidisstraße"]->.foo node(w.foo){out;}
.
- around: written as (around.input set:radius). The around statement currently is only compatible to output of type node, and I even haven't decided on the semantics for the other cases. The input set including the leading dot can be omitted. It then default to _. An example is
node[name="Lichtscheid"]node(around:1000)[highway=bus_stop]{out;}
.
- user/uid: written as (user:"name") resp. (uid:id). Selects all elements last touched by the given user. The user can be selected by her user name (use user) or user id (use uid). Examples are
way(user:"Roland Olbricht"){out;}
or way(uid:65282){out;}
.
- newer: similar to user.