Generalized Cost on Streets


Conveyal Analysis finds paths through street networks that minimize travel time. This is consistent with the way it finds paths through transit. When calculating travel time over a road segment, by default the only things considered are the length of the segment and the walk or bicycle speed specified in your request. In the case of car routing we use a speed attached to each road segment from OSM tags.

A time penalty is added at each turn to reflect time spent waiting to turn across traffic and to discourage paths that zigzag excessively. By default this is only applied for cars, and is higher for left turns (30 seconds) than for right turns (10 seconds). Through relatively minor modifications these penalties can be reversed for countries where right turns are across traffic.

For various reasons it can be useful to customize the factors influencing travel along each street segment, or the time spent turning from one segment to another. We have created extension points where custom plugins can be used to provide travel times that are more accurate (accounting for details like biking up hills or slow crosswalks) or serve as generalized costs capturing safety and comfort.

There is currently no technical difference between the way more accurate timings and generalized costs are handled. The only difference is in the interpretation. In either case, the plugins return adjusted distances (which are traversed at the specified speeds) and turning times (which are constants unaffected by speed).

The length of every street segment between intersections can be scaled independently. At every intersection, each left and right turn and each movement straight through an intersection can have a distinct cost.

LADOT Generalized Costs

Specifically in the LADOT case, we use cost supplier plugins (LaDotBikeCostSupplier, LaDotWalkCostSupplier) which use OSM tags read by the LaDotCostTags class. This requires specialized tags in OSM input data, which must be generated by external scripts.

Input Data

In order to activate the generalized cost computations, all tags listed below must be defined on every edge in the input OSM. This mechanism may eventually be extended, with R5 deriving these characteristics from standard OSM tags that are used in a wider range of places.

This input OSM data must be processed into ways that have no intersections except at their endpoints. OSM data in this form is created by the data preparation scripts at The Python OSM library used there naturally breaks ways into routable edges between intersections as required.

OSM ways are generally bidirectional: they represent the centerline of a road that may allow traffic (including walking or biking) in either direction. Therefore each of the tags listed here must be suffixed with :forward or :backward to specify values in both directions. The forward direction follows the ordered sequence of node IDs within the OSM way.

Slope Tags

For the time being, elevation changes are reported as the percentage of each road falling into different percentage grades. Eventually we may move toward storing full elevation profiles, rather than these derived bins.

  • slope_1 percentage of way at 2-4% grade
  • slope_2 percentage of way at 4-6% grade
  • slope_3 percentage of way above 6% grade
  • slope_4 percentage of way above 10% grade

Note that the last two categories overlap, because the first is used for biking and the second for walking.


These tags give the Annual Average Daily Traffic (AADT) on the way and through the intersections at its ends.

  • self_aadt is the traffic on the way itself (no forward/backward suffixes, currently unused)
  • cross_aadt cross traffic on the perpendicular way through the intersections
  • parallel_aadt is the traffic on the way itself in each direction

Intersection Tags

Tags describing intersection features (control types, crosswalks, cross_aadt) refer to the intersection at the end of the street segment (not the beginning) in each direction (forward/backward). These tags describe intersections:

  • control_type is one of {none, stop, signal}
  • bike_infra is one of {no, path, blvd}
  • xwalk is one of {none, signal, unsig}

Road Type Tags

These tags describe the type of road so we can recognize busy or dangerous roads. The forward/backward suffixes do not apply here.

  • unpaved_alley is one of {true/yes; other}
  • highway is any value, with "high traffic" defined as those having a value in {tertiary, tertiary_link, secondary, secondary_link, primary, primary_link, trunk, trunk_link, motorway, motorway_link}

Other Tags

Like all other tags listed here, these must be present on every way but are not currently used:

  • speed_peak
  • speed_offpeak

Walk Costs

This explains how walk costs are derived from the tags.

Perceived length: sections over 10% grade count double. Unpaved roads and alleys count 51% more. Busy roads are penalized by 14%.

Turn costs are defined in terms of meters traveled at a standardized speed of 1.3 meters per second (not affected by the walking speed in the analysis request). Traversing any intersection has a fixed cost of 54 meters (41.5 seconds). Daily traffic over 10k adds a penalty of 28 meters (21.5 seconds) if there is no crosswalk at all; daily traffic over 13k adds a penalty of 73 meters (56.2 seconds) if there is no signalized crosswalk. The traffic figure used is the cross traffic when moving straight through an intersection; it is the greater of the traffic in the forward or backward directions when turning left (across traffic).

Bike Costs

This explains how bike costs are derived from the tags.

Perceived length: sections at 2-4% grade count 37% more, sections at 4-6% grade count 123% more, and those over 6% grade count 324% more. Bike boulevards get an 11% bonus and bike paths a 16% bonus. Where bike infrastructure is not present, busy roads are penalized based on the road's average daily traffic. Roads over 30k vehicles/day are penalized by 716%, those over 20k by 140% and those over 10k by 37%.

Turn costs are defined in terms of meters traveled at a standardized biking speed of 4 meters per second (not affected by the biking speed in the analysis request). All turns receive a penalty of 54 meters (13.5 seconds), which does not apply when going straight through an intersection. Stop signs and signals add 6 and 27 meters (1.5 and 6.8 seconds) respectively.

Right turns are penalized by 50 meters (12.5 seconds) if the daily traffic of the cross road exceeds 10k. Left turns onto busy cross streets, and passing straight through intersections with busy streets are penalized in the same way: 424 meters (1 minute, 46 seconds) if the cross traffic exceeds 20k/day, 81 meters (20.3 seconds) if it exceeds 10k/day, and 78 meters (19.5 seconds) if it exceeds 5k/day.

Left turns from busy streets are also affected by parallel traffic: 297 meters (1 minute, 14 seconds) for over 20k/day, and 117 meters (29.3 seconds) for over 10k/day.