Contents
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=multimodalfails 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:
| costing | description |
|---|---|
auto | Automobile routing |
bicycle | Bicycle routing |
pedestrian | Walking/pedestrian routing |
bus | Bus routing (to plan a hypothetical bus route that follows roads) |
truck | Truck routing (avoids low clearances, weight limits) |
motorcycle | Motorcycle routing |
motor_scooter | Motor scooter routing (avoids freeways, tends to avoid hills) |
taxi | Taxi/rideshare routing (may use HOV/bus lanes) |
bikeshare | Bikeshare 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
- Interline Routing Platform: the endpoints that use these graphs.
- Journeys and Itineraries: results of transit routing.
- Source Feeds: where the transit graph's schedules come from.