Question

ShortestPathFinder and one-ways


Badge

Do you have an example on how to deal with one-ways using the ShortestPathFinder?

The goal is to use ShortestPathFinder for routing.


2 replies

Userlevel 5

Hi

You need to set the "Cost type" to "By two attributes", one for each direction relative to the direction of each polyline. For one way streets you could set the cost = length* for the allowed direction and cost = some huge number (e.g. one billion) for the disallowed direction. For bi-directional streets you could set the cost to be identical in both directions.

* I recommend not using something as simple as a purely length-based cost number, as it might route you through residential areas rather than the highway if that is just slightly shorter. Personally I've had some success in using a formula derived from a combination of segment length and road class and/or speed limit, e.g. so that a highway segment gets a relatively lower cost than a residential segment of the same length. You will have to play around to see what works for your case.

David

Userlevel 5

Hi

You need to set the "Cost type" to "By two attributes", one for each direction relative to the direction of each polyline. For one way streets you could set the cost = length* for the allowed direction and cost = some huge number (e.g. one billion) for the disallowed direction. For bi-directional streets you could set the cost to be identical in both directions.

* I recommend not using something as simple as a purely length-based cost number, as it might route you through residential areas rather than the highway if that is just slightly shorter. Personally I've had some success in using a formula derived from a combination of segment length and road class and/or speed limit, e.g. so that a highway segment gets a relatively lower cost than a residential segment of the same length. You will have to play around to see what works for your case.

David

Just a heads up: The ShortestPathFinder is a bit limited in that it does not support e.g. turn restrictions, so be sure to understand your requirements and the limitations of the transformer before using the results for anything critical.

Reply