NREL / routee-compass

The RouteE-Compass energy-aware routing engine
https://nrel.github.io/routee-compass/
BSD 3-Clause "New" or "Revised" License
9 stars 4 forks source link

Compute edge headings for start and end #202

Open nreinicke opened 1 month ago

nreinicke commented 1 month ago

In our current generate_dataset function, we use the edge bearings generated from osnmx which computes the bearing from the origin node to the destination node. This is a good approximation but RouteE Compass allows us to specify a bearing for both the beginning and end of a road link. This is useful for computing the difference in angle between two links that might have significant curvature.

Imagine a (somewhat contrived) example where we have two links with curvature connected to each other like this:

image

If we just use the bearing between the start and end nodes, it will appear as if the vehicle is not turning at all between the two links but in reality the vehicle is making an ~90 degree turn.

In order to support this we should use the geometry from the link and then take the first two points in the linestring to compute the arrival_heading and the last two points in the linestring to compute the departure_heading.