Skip to content
Documentation

Routing Graph and Costing Models

Routing engines search a graph: a network of edges with costs attached, built ahead of time from map or schedule data. The Interline Routing Platform uses two separate graphs.

Street and transit graphs

The street graph is built from OpenStreetMap and covers the world. It includes roads, paths, turn restrictions, surfaces, and elevation, and serves street routing, matrix, isochrone, and the other street endpoints. It is rebuilt approximately daily from Interline Valhalla Tilepacks, which are built from the latest OpenStreetMap data and include Tilezen elevation tiles.

The transit graph is built from Transitland's archive of GTFS source feeds and covers the United States. It includes stops, scheduled trips, and transfers, and serves transit routing. New feed versions are added within minutes of import.

Because the graphs are separate:

  • Transit routing is a separate endpoint. The street endpoints do not route on transit. A street request with costing=multimodal fails with an error that the locations are in unconnected regions.
  • Coverage differs. Street routing covers the world; transit routing covers the United States.
  • Update frequency differs. The street graph is rebuilt about daily; the transit graph updates within minutes of a new feed version.

Street costing models

A costing model is the set of rules that converts the street network into travel costs for one mode. The same road can be fast for a car, prohibited for pedestrians, and penalized for bicycles.

Each street routing request sets a model with the costing parameter:

costingdescription
autoAutomobile routing
bicycleBicycle routing
pedestrianWalking/pedestrian routing
busBus routing (to plan a hypothetical bus route that follows roads)
truckTruck routing (avoids low clearances, weight limits)
motorcycleMotorcycle routing
motor_scooterMotor scooter routing (avoids freeways, tends to avoid hills)
taxiTaxi/rideshare routing (may use HOV/bus lanes)
bikeshareBikeshare routing (mix of bicycle and pedestrian)

Dynamic costing

Valhalla applies costing while the search runs, using parameters sent with each request. The graph stores network attributes, so changing costing does not require rebuilding it. This is called dynamic costing.

Options such as the penalty for unpaved surfaces, toll avoidance, wheelchair access for pedestrians, and a bicycle preference for quieter streets are costing_options values set on a single request.

For the full set of options each model accepts, see the Valhalla costing models reference, or the request schema on any street routing endpoint page, which lists them with their types and defaults.

See also