Relation:restriction is invalid
#Hello, Everyone! I have a question. @danpat @mjjbell @daniel-j-h
Through OpenStreetMap wiki, I learned that I could use Relation:restriction to solve some turning problems.
https://wiki.openstreetmap.org/wiki/Relation:restriction
For example,

<relation id="1" changeset="1" timestamp="2022-08-22T06:58:29Z" user="zhou" uid="4437318">
<member type="way" ref="a" role="from"/>
<member type="way" ref="b" role="via"/>
<member type="way" ref="c" role="to"/>
<tag k="restriction" v="no_right_turn"/>
<tag k="type" v="restriction"/>
</relation>
but, the.OSM file that i compiled with this format does not solve the turning problem.
Is it because OSRM doesn't support it yet?
Historically, this “way-vias” (fromWayId, viaWayId, toWayId) has been tried to handle
https://github.com/Project-OSRM/osrm-backend/issues/2681
Restrictions are supported by OSRM.
Can you share an OSM link to the junction in question, or a link to the OSM file you are using?
Restrictions are supported by OSRM.
Can you share an OSM link to the junction in question, or a link to the OSM file you are using?
Have “way-vias” (fromWayId, viaWayId, toWayId) and “node-vias” (fromWayId, viaNodeId toWayId) been supported? Is it because CH supports it, but MLD still doesn't?
I'm using SHP files to convert to OSM files, so the output file is huge. I can upload part of the file, could you please help to analyze it? The content format of the files is basically the same.
Have “way-vias” (fromWayId, viaWayId, toWayId) and “node-vias” (fromWayId, viaNodeId toWayId) been supported?
Yes, it supports both
Is it because CH supports it, but MLD still doesn't?
Processing of restrictions happens prior to algorithm specific processing. It is supported by both.
I'm using SHP files to convert to OSM files, so the output file is huge. I can upload part of the file, could you please help to analyze it? The content format of the files is basically the same.
It will be hard to reproduce correctly if the whole file is not available. Given that you're converting from another data source, I suspect the problem is somewhere in the conversion logic.
having done this kind of exercise quite often, I also suspect connectivity problems for the relation. you can check that somewhat with osmium, e.g. osmium getid --add-referenced <osm_file> <turn_restriction_id> which should output the right ways, i.e. find the ways by id and their node id's & coordinates. visualizing in josm also helps a lot if you break it down to a small area (josm gets really slow for larger extracts than a few MB).
Well, thank you very much for your suggestion. I'll try it out.
Maybe I'm using an older version? It's Version 5.23.0
This is part of the OSM file. test.osm
@mjjbell I wonder if this file will give us any clues.
https://github.com/Project-OSRM/osrm-backend/pull/5907 Does the latest master branch already contain the change? If so, can I try it with the latest master?
@mjjbell I wonder if this file will give us any clues.
Yes, the relations refer to ways and nodes that don't exist in the file. You'll need to figure out why that's happening.
@mjjbell I wonder if this file will give us any clues.
Yes, the relations refer to ways and nodes that don't exist in the file. You'll need to figure out why that's happening.
The original data in the file contains these nodes and ways, because some nodes and ways are deleted randomly. The point is, is there a problem with the format? Thank you very much for your answer. I will make some attempts according to your answer.
Please do not close the issue yet.
The original data in the file contains these nodes and ways, because some nodes and ways are deleted randomly.
Can you use “osmium extract” for the extraction? By default it will complete ways, ie pull in all nodes of all ways which appear spatially in the bbox you’re extracting with. We need the full topology extracted from your OSM file for your relation: all way and node objects it’s referencing (recursively) in case they all even exist.
Maybe I'm using an older version? It's Version 5.23.0
This is part of the OSM file. test.osm
@mjjbell I suspect the 5.23.0 branch does not support via-ways.
i made a try, i routed it using the branch 5.23.0 and my test.osm data, and the result was wrong. But, when i routed with the branch 5.26.0 and the same test data, the results were correct.
I see. Single via-ways are supported in 5.23.0 and multiple via-ways were added in 5.24.0, so I suspect that's the change that made the difference.
the test data does not contain multiple via-ways. you can verify the problems that with 5.23.0 and 5.24.0 on via-ways.
osmium getid --add-referenced <osm_file> <turn_restriction_id>
I'm learning how to use osmium. Also, are there any tools to visualize the .osm data?
This issue seems to be stale. It will be closed in 30 days if no further activity occurs.