graphhopper icon indicating copy to clipboard operation
graphhopper copied to clipboard

Turn restrictions don't work with negative ids

Open mmuelder opened this issue 9 years ago • 3 comments

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

mmuelder avatar Nov 16 '17 15:11 mmuelder

Ah, ok. We had problems before with this https://github.com/graphhopper/graphhopper/issues/42 and must be fixed, so thanks for reporting!

karussell avatar Nov 16 '17 16:11 karussell

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 ;-)

mmuelder avatar Nov 16 '17 17:11 mmuelder

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.

easbar avatar Aug 30 '22 06:08 easbar