Home |
Last modified: 10-02-2018 |
A quick tutorial on using OverpassTurbo to query OpenStreetMap. OT is a frontend to create and display queries to work with servers that support the Overpass API.
Examples will use the newer QL syntax instead of the older, and more complex XML syntax. Use http://overpass-api.de/convert_form.html to convert XML samples into QL.
A query has three or four parts:
"The QL syntax is more concise, and is to some extend similar to C-like programming languages. A statement always ends with a semicolon ";". Furthermore, a statement is either:
Query statements consist of the type [node, way, relation] and of at least one clause (eg. ["key"])." http://wiki.openstreetmap.org/wiki/Overpass_API/Language_Guide
"OpenStreetMap represents physical features on the ground (e.g., roads or buildings) using tags attached to its basic data structures (its nodes, ways, and relations). Each tag describes a geographic attribute of the feature being shown by that specific node, way or relation.
http://wiki.openstreetmap.org/wiki/Map_Features
(r)
(w)
(n)
(br)
(bw)
(bn)
(>)
(>>)
(<)
(<<)
Why bad?
relation["network"="RER"]["ref"="C"]
({{bbox}});
out body;
We'll use "out center" to turn polygons (ways) into nodes, for better display in maps:
Search "Gielgen" close to Bonn:
http://wiki.openstreetmap.org/wiki/Buses
highway=bus stop
route=bus
[out:json][timeout:25];
(
relation["route"="bus"]({{bbox}});
);
out body;
>;
out skel qt;
http://gis.19327.n5.nabble.com/Plans-lignes-RER-td5835260i20.html
[out:json][timeout:25];
(
relation["network"="RER"]["ref"="C"]({{bbox}});
);
out body;
>;
out skel qt;
---
[out:json][timeout:25];
(
relation["network"="RER"]["ref"="C"]({{bbox}});
);
node(r);
out body;
>;
out skel qt;
Provided it's unique…
relation["network"="VRS"]["ref"="636"];
out
body;
node ["highway"="bus_stop"] ({{bbox}});
out body;
[out:json][timeout:25];
(
relation(1258954)({{bbox}});
);
out body;
>;
out skel qt;
{{style:
node {
symbol-size: 5;
}
}}
http://www.overpass-api.de/api/sketch-line?ref=1&network=fr_star&style=wuppertal
http://www.overpass-api.de/api/sketch-line?ref=1&network=fr_star&style=padua
http://www.overpass-api.de/api/sketch-line?network=fr_star&ref=1&operator=&correspondences=&width=1000%C3%A0&height=500&font-size=&force-rows=1&max-cors-per-line=&max-cors-below=&style=
From "Public Transport Line Diagram"
Nécessaire si l'on a besoin de récupérer tous les éléments d'une relation ou d'un way ("route"?).
(
…
>;
);
(
._;
nodes(r);
);
What does this do? Why use ()? What does "<;" do?
(node(51.249,7.148,51.251,7.152);<;); out;