itinero / routing

The routing core of itinero.
Apache License 2.0
221 stars 70 forks source link

Question: Get turn restriction info #232

Open fromm1990 opened 5 years ago

fromm1990 commented 5 years ago

Hi, i'm unable to figure out how to retrieve information about turn restrictions.

turnrestrictionproblemitinero

Consider the provided graph where it is allowed to go from AB to BC and from BC to BD, however, it is not allowed to go from AB to BD due to a turn restriction.

I have tried to instantiate the Turn class using vertex a, b, d, however, IsRestrictedBy returns false. This is most likely happening because i provide the RestrictionCollection from my RouterDb which is empty. The RouterDb is build from an osm.pbf file, so I assume the turn restrictions are read automatically?

Is it possible to retrieve turn restrictions from the graph? If yes, how is it done?

xivk commented 5 years ago

You can get restrictions from the routerdb by using this method:

https://github.com/itinero/routing/blob/develop/src/Itinero/RouterDb.cs#L484

The vehicle type there corresponds to the vehicle type used in the profiles:

https://github.com/itinero/routing/blob/develop/src/Itinero/Osm/Vehicles/car.lua#L3