GraphHopper.com | Forum | GitHub | Maps | Blog

Reduce number of turns


#1

Do you have any suggestion on how to control the number of turns in a path? The goal would be to create paths with a reduced number of turns (I’m using a custom vehicle and weighting scheme that produces very fragmented paths while I’d like to have “smoother” ones).

I played a bit with the getTurnCost function but I didn’t see any changes in the resulting paths.

thanks!


#2

You’ll need to add turn costs for all the junctions or turns you need and then evaluate this in the TurnWeighting. See the unit tests for these classes.