Routes as location references
Currently TraFF lacks the ability to describe more complex routes where road attributes may change along the way, and/or the route from one point to another is ambiguous even with a (single) via
point.
This can be addressed in a more comprehensive manner by supporting routes for locations.
For backward compatibility, these routes should use from
and to
for their start and end point.
The route between these points should be described as a series of points, encapsulated in a new child element of location
.
To describe a route in this way, encoders should first split the route into segments at each junction (i.e. points where ways cross, split or join), then place a point on each segment, preferably close to its middle. It is generally not recommended to omit points, or add extra ones.
To compute a route for a “traditional” location, a routing algorithm has worked well:
- Each segment of road has a cost based on its length, and optionally how well its attributes match those of the location (good matches have a lower cost).
- The link between one of the location’s reference points any any other point also has a cost based on its length, with a heavy penalty factor (so roads will be preferred)—this is necessary to handle reference points located slightly off-road (or even on the opposite carriageway).
- The route is then computed with least-cost routing.
This could be adapted to route descriptions by adjusting the cost of ways based on their distance from the nearest route point (the closer they are to a point, the lower the cost). If encoder and decoder use slightly different map data, the route will thus be approximated as closely as possible.