compute_depot_route
Compute a full depot-to-depot trip rate from two pins. The engine routes each pin's drive to a nearby interstate on-ramp on the road network (from the pin itself, off the interstate), prices that access leg through the S2 cells it crosses, routes the interstate leg between the two ramps, and returns a three-leg breakdown. Available for depot-capable regions, which today means interstates. Check regions() for the live set.
HumanBaselines.compute_depot_route(
depot_a: PinLike,
depot_b: PinLike,
selections: DepotSelections | dict | None = None,
*,
region: str | None = None,
**filters,
) -> DepotComputeResultEach pin is a (lat, lon) tuple, a DepotPin, or a {"lat": ..., "lon": ...} dict. Filters work the same three ways as compute.
Example
trip = hb.compute_depot_route(
depot_a=(30.25, -97.75),
depot_b=(30.40, -97.70),
ego_vehicle=["combination"],
)
print(trip.total["rate"], trip.total["rate_low"], trip.total["rate_high"])Returns: DepotComputeResult
A three-leg trip, where each leg carries its own rate metrics and total aggregates them. The model is deliberately permissive, since it also carries rendering geometry, so access fields by key:
| Field | Description |
|---|---|
access_a / access_b | Access-leg metrics (geofence-shaped, with cells). |
interstate | Interstate-leg result (route-shaped, with segments). |
total | Aggregated trip rate + 95% CI. |
depot_a / depot_b | The pin's access leg: its s2_cell, the chosen onramp_id with its route and milepost, access_distance_mi (the driven miles to it), and lat/lon of the ramp's surface end. |
access_cells_a_vertices / ..._b_vertices | Per-cell polygon corners [[lon, lat], …] for rendering. |
access_path_a / access_path_b | The routed off-interstate drive from each pin to its on-ramp, as a polyline [[lon, lat], …], for drawing the access leg. |
Where pins are accepted
A pin must sit in the region's covered counties, within 3 mi of a road, and within 30 mi of an interstate on-ramp; otherwise the call is a validation error (400) naming the pin and the reason. The access leg avoids motorways: it is the drive to the interstate, so a pin beside a freeway uses the nearest entrance it can reach on local roads. If the routing service is unavailable the call returns 503.