Skip to content

compute_depot_route

Compute a full depot-to-depot trip rate from two pins. The engine snaps each pin to its nearest access cell, picks an on-ramp, routes the interstate leg, and returns a three-leg breakdown. Available for depot-capable regions: travis, ca_interstates, sw_interstates (check regions()).

python
HumanBaselines.compute_depot_route(
    depot_a: PinLike,
    depot_b: PinLike,
    selections: DepotSelections | dict | None = None,
    *,
    county: str | None = None,
    **filters,
) -> DepotComputeResult

Each pin is a (lat, lon) tuple, a DepotPin, or a {"lat": ..., "lon": ...} dict. Filters work the same three ways as compute.

Example

python
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; each leg carries its own rate metrics and total aggregates them. The model is intentionally permissive (it also carries rendering geometry), so access fields by key:

FieldDescription
access_a / access_bAccess-leg metrics (geofence-shaped, with cells).
interstateInterstate-leg result (route-shaped, with segments).
totalAggregated trip rate + 95% CI.
depot_a / depot_bSnapped pin: s2_cell, onramp_id, route, milepost.
access_cells_a_vertices / ..._b_verticesPer-cell polygon corners [[lon, lat], …] for rendering.

Snap distance

A pin farther than the server's snap limit from any known access cell raises a validation error (400). Place depots near mapped roads within the region's coverage.

Derived statistics only. Attribute every published figure. Maintained by Valgo.