Hi!
I’m learning Overpass QL and just noticed a strange behavior from the Overpass API. I think it is probably a bug, but maybe I’m doing something wrong?
I’m running the following simple query, which tries to download all nodes, ways and relations from a train route, a relation with the name “S8: Wiesbaden => Mainz Hbf => Hanau” I. My intention is to use the data to recreate and plot the tracks on my computer.
// Query settings
[out:json][timeout:25];
// Get the relation that interests us
relation["name"="S8: Wiesbaden => Mainz Hbf => Hanau"];
// Recurse down and get all info from all members and sub-members
>> -> .s8_all;
// Filter out all members outside of bbox
nwr.s8_all(49.987325, 8.237257, 50.035367, 8.318367) -> .s8_bbox;
// Return all details
.s8_bbox out;
In Overpass Turbo, I export the data as JSON (“raw OSM data”) and plot the route in my computer.
Then I notice the following problem:
This is what the overpass turbo website shows: https://overpass-turbo.eu/s/1Trc
This is what my own plot shows, based on the exported data:
See those blue lines jumping out of the tracks? They shouldn’t be there.
I’ve dived into the data to see what the problem is, and found the following:
- The jumping lines originate at node 571665114.
- That particular node is the edge node between two ways: way
45087986(North of the node) and way172430977(South of the node). - In the JSON export, edge nodes typically appear as the last node of one way and the first element of the next. However, this node appears as the last node of both ways:
{
"type": "way",
"id": 45087986,
"nodes": [
571665104,
2206001213,
571665114
],
}
{
"type": "way",
"id": 172430977,
"nodes": [
1833363809,
5200797311,
3994516701,
11592724831,
11295780887,
3946270847,
1833363813,
3946270846,
1833363817,
3946270848,
571665114
],
}
- Upon further inspection, I realize that way
172430977has its orientation reversed. Thus, when plotting, the blue line follows45087986southwards until its last node. Then it continues to the first listed node of172430977, which corresponds to its southern end, creating the first visible jump in the plot. It then goes back along172430977, and once it reached the northern edge, it jumps to the first node of the next way, creating the second visible jump.
All ways in the data export are orientated in the correct way, except 172430977 and a few more down the line. However, there are no jumps visible in Overpass Turbo.
I don’t understand why a few of the ways have their orientation reversed. Could this be a bug from the API? Or is there something subtly wrong with my query?
Other things I have tried that yield the same problem in the JSON export:
- Use OSMPythonTools instead of Overpass Turbo. If it’s a bug, it’s not in Overpass Turbo.
- In the query, used
>>instead ofnwr.s8_all(49.987325, 8.237257, 50.035367, 8.318367)

