Turn restrictions don't work with negative ids
Greetings!
Today I created a turn restriction using JOSM but GH (0.9) just ignored it. I double and triple checked everything, but the OSM tags where correct. After spending many hours I eventually found the cause: negative IDs. I'm not sure whether it was the node, ways or relation IDs. But after I replaced all negative IDs in the OSM files with positive ones, the restiction suddenly worked like a charm. I reproduced this many times. Existing restrictions (thus positive ids) work, newly created in Josm (thus negative ids) don't.
Unfortunately I have no Java experience so I can't provide any test code or the like, but I hope someone can confirm this issue.
Best Marius
Ah, ok. We had problems before with this https://github.com/graphhopper/graphhopper/issues/42 and must be fixed, so thanks for reporting!
FYI:
Removing
if (fromWayID >= 0 && toWayID >= 0 && viaNodeID >= 0) {
from OSMReader.java:849
and
&& wayId >= 0
from OSMTurnRelation.java:92
makes it work. However, I have no idea what the collateral damage is ;-)
We fixed this by not allowing negative OSM ids in the imported OSM file anymore (#2652). Negative ids are still used internally to create artificial edges that replace barrier nodes.