Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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:

  1. 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’s LineString geometry.
    • linestring_stride (default): Interpolates points at a regular distance interval (stride, e.g., every 100.0 meters) along each reached link’s LineString geometry, 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.
  2. 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 by concavity (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 fixed k (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\).
  3. Serialization Format (isochrone_format): How the resulting polygon is encoded in result.csv and result.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: GeoJSON Feature string.

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"

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 DistanceDegrees (lat/lon)
~15 meters0.000135
~30 meters0.0003
~100 meters0.0009
~250 meters0.00225–0.0025
~500 meters0.0045

Running BAMBAM

cd denver_buf

../rust/target/release/bambam \
  --config-file bambam.toml \
  --query-file ../query/denver_extent.json

3. What Happens

  1. Binned Branch Collection:
    • For each completed search tree, the isochrone output plugin retrieves the binned, deduplicated destination branches prepared by the bambam configuration (e.g., for the 10-, 20-, 30-, and 40-minute bins).
  2. 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 a MultiPoint cloud according to isochrone_point_model (e.g., interpolating points every 100 meters along each reached roadway LineString).
  3. Concave Hull & Simplification (isochrone_algorithm):
    • If a bin contains fewer than 3 points, BAMBAM emits an empty POLYGON EMPTY geometry.
    • Otherwise, BAMBAM runs the configured hull algorithm (such as concave_hull with concavity = 1.2 and length_threshold = 0.0025) and optionally simplifies the exterior ring using Ramer-Douglas-Peucker (simplify_epsilon_latlon = 0.0003) to keep output file sizes small.
  4. 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 to opps_count_<bin>) and the serialized polygon (aggregate_opportunities.<bin>.isochrone, mapped to isochrone_<bin> in result.csv).