Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Calculate route where current road is preferred #313

Open
ohjulstad opened this issue May 15, 2020 · 1 comment
Open

Question: Calculate route where current road is preferred #313

ohjulstad opened this issue May 15, 2020 · 1 comment

Comments

@ohjulstad
Copy link

Hi, I am new to Itinero and route planners, and in my project I try to get the route planner to prefer the current road number. So I want to add a “penalty” to turning off the current road number. We have already used the road classifications in the lua file to get the route planner to prefer some types of roads, however I am unable to see if it is possible in the lua profile to calculate the factor based on current road number and increase the cost of turning off the road.
I have investigated creating a CustomWeightHandler for this? But I am unsure if this is the right approach or even possible.

We have genereated our own routerdb file with road number and road category as some of the edge attributes

Any pointers would be helpful! Thanks!

@juliusfriedman
Copy link

juliusfriedman commented May 15, 2020

See turnPenalty in the source code and example is @ #307 I think

//Indicate no turns are preferred
                const float?[] NoPreferredTurns = null;
//Try to calculate a route without any u turns
                var route = Router.TryCalculate(profile, routerPoints, float.MaxValue, NoPreferredTurns, cancellationToken);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants