Isochrone Generation
1. Overview
An isochrone (or travel shed) is a polygon delineating the geographic area reachable from an origin within a given travel time, distance, or energy threshold. In BAMBAM, isochrones provide both visual insight into how road network topology, barriers (rivers, highways), and modal speeds shape mobility, and geometric polygons for spatial overlay analysis.
Generating an accurate isochrone from a shortest-path tree involves three configuration choices in the bambam output plugin, which are then executed by the isochrone output plugin:
- Point Sampling Model (
isochrone_point_model): How BAMBAM extracts 2D coordinate points from the reached branches of the search tree:destination_point: Uses only the endpoint coordinate of each reached link. Fast, but can miss intermediate curvature along long rural or highway links.linestring_coordinates: Includes all shape vertices along each reached link’sLineStringgeometry.linestring_stride(default): Interpolates points at a regular distance interval (stride, e.g., every100.0meters) along each reached link’sLineStringgeometry, ensuring uniform point density along both short urban blocks and long highway segments.buffered_linestring/buffered_destination_point: Generates a circular buffer of points (buffer_radius) around each reached link or destination vertex.
- Hull Construction Algorithm (
isochrone_algorithm): How BAMBAM wraps the sampled point cloud into a polygon:concave_hull(default): Fits a concave hull around the point cloud controlled byconcavity(smaller values hug the road network more tightly),length_threshold(minimum edge length in lat/lon degrees for inward subdivision), and optional Ramer-Douglas-Peucker smoothing (simplify_epsilon_latlon).k_nearest_concave_hull: Constructs a concave hull using the \(k\)-nearest neighbors algorithm with a fixedk(must be \(\ge 3\)).k_nearest_log_scaled/k_nearest_sqrt_scaled: Dynamically scales \(k = c \cdot \log_b(n)\) or \(k = \sqrt{n}\) based on the number of reached points \(n\).
- Serialization Format (
isochrone_format): How the resulting polygon is encoded inresult.csvandresult.json:wkb(default): Hex-encoded Well-Known Binary—compact and fast to parse in GeoPandas (geopandas.GeoSeries.from_wkb) or PostGIS.wkt: Human-readable Well-Known Text (POLYGON ((...))).geo_json: GeoJSONFeaturestring.
2. Setup
Configuring Isochrones in bambam.toml
Isochrone parameters are declared inside the bambam output plugin block, followed by the isochrone output plugin:
[[plugin.output_plugins]]
type = "bambam"
format = "aggregate"
isochrone_format = "wkb"
binning.type = "global"
binning.value = { type = "time", feature = "trip_time", values = [10, 20, 30, 40], unit = "minutes" }
isochrone_point_model.type = "global"
isochrone_point_model.value = { type = "linestring_stride", stride = 100.0, distance_unit = "meters" }
isochrone_algorithm.type = "global"
isochrone_algorithm.value = { type = "concave_hull", concavity = 1.2, length_threshold = 0.0025, simplify_epsilon_latlon = 0.0003 }
[[plugin.output_plugins]]
type = "isochrone"
Modal Point Sampling Example
Because walking trees cover dense, short blocks while driving trees span long highway corridors, you can vary the sampling density by mode using type = "modal":
[plugin.output_plugins.isochrone_point_model]
type = "modal"
values.walk = { type = "linestring_stride", stride = 20.0, distance_unit = "meters" }
values.bike = { type = "linestring_stride", stride = 50.0, distance_unit = "meters" }
values.transit = { type = "linestring_stride", stride = 50.0, distance_unit = "meters" }
values.drive = { type = "linestring_stride", stride = 150.0, distance_unit = "meters" }
Reference for concave_hull Degree Thresholds
Both length_threshold and simplify_epsilon_latlon on concave_hull are specified in decimal degrees (latitude/longitude):
| Approximate Ground Distance | Degrees (lat/lon) |
|---|---|
| ~15 meters | 0.000135 |
| ~30 meters | 0.0003 |
| ~100 meters | 0.0009 |
| ~250 meters | 0.00225–0.0025 |
| ~500 meters | 0.0045 |
Running BAMBAM
cd denver_buf
../rust/target/release/bambam \
--config-file bambam.toml \
--query-file ../query/denver_extent.json
3. What Happens
- Binned Branch Collection:
- For each completed search tree, the
isochroneoutput plugin retrieves the binned, deduplicated destination branches prepared by thebambamconfiguration (e.g., for the 10-, 20-, 30-, and 40-minute bins).
- For each completed search tree, the
- Geometry Point Cloud Generation (
isochrone_point_model):- For each bin, BAMBAM looks up the reached edge geometries in the RouteE Compass
MapModel(<mode>/edges-geometries-enumerated.txt.gz) and extracts aMultiPointcloud according toisochrone_point_model(e.g., interpolating points every 100 meters along each reached roadwayLineString).
- For each bin, BAMBAM looks up the reached edge geometries in the RouteE Compass
- Concave Hull & Simplification (
isochrone_algorithm):- If a bin contains fewer than 3 points, BAMBAM emits an empty
POLYGON EMPTYgeometry. - Otherwise, BAMBAM runs the configured hull algorithm (such as
concave_hullwithconcavity = 1.2andlength_threshold = 0.0025) and optionally simplifies the exterior ring using Ramer-Douglas-Peucker (simplify_epsilon_latlon = 0.0003) to keep output file sizes small.
- If a bin contains fewer than 3 points, BAMBAM emits an empty
- Serialization to Output Columns:
- For each bin key (
10,20,30,40), the plugin records both the number of reached destination vertices (aggregate_opportunities.<bin>.n_destinations, mapped toopps_count_<bin>) and the serialized polygon (aggregate_opportunities.<bin>.isochrone, mapped toisochrone_<bin>inresult.csv).
- For each bin key (