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

Shared Micromobility (GBFS)

1. Overview

Shared micromobility systems—such as docked and dockless bikeshare and e-scooter fleets—publish operational data using the GBFS (General Bikeshare Feed Specification) standard. In an access study, shared micromobility acts as a first-mile, last-mile, or point-to-point mode governed by spatial geofencing rules:

  • Service and Boarding Zones: Where a traveler is allowed to pick up a vehicle and start a ride (ride_start_allowed).
  • Ride-Through Zones: Where a boarded rider is permitted to travel (ride_through_allowed) and whether localized speed caps apply (maximum_speed_kph).
  • Drop-Off Zones: Where a rider is permitted to end a trip and park the vehicle (ride_end_allowed).

BAMBAM’s bambam-gbfs tool downloads GBFS feeds (supporting v2.2, v2.3, and v3.0), extracts geofencing zones and operational rules, and compiles them into spatial lookup tables that constrain and price micromobility legs during multimodal routing.


2. Setup

1. Download and Process GBFS Feeds (bambam-gbfs)

First, compile the workspace binaries (including bambam-gbfs) and download either a single GBFS endpoint or a batch of feeds from a MobilityData systems.csv catalog into denver_buf/gbfs/:

# Download a single GBFS feed endpoint
./rust/target/release/bambam-gbfs download \
  --gbfs-url "https://example-operator.com/gbfs/3.0/gbfs.json" \
  --version v3.0 \
  --output-directory denver_buf/gbfs \
  --overwrite

# Or batch-download from a systems.csv catalog
./rust/target/release/bambam-gbfs batch-download \
  --csv-file systems.csv \
  --csv-column "Auto-Discovery URL" \
  --entry-point gbfs \
  --output-directory denver_buf/gbfs \
  --parallelism 8 \
  --overwrite

This creates three files in denver_buf/gbfs/:

  • edges-gbfs-geofences-enumerated.txt.gz: WKT polygon geometries for each geofence zone.
  • edges-gbfs-records.csv.gz: Zone attributes (system_id, ride_start_allowed, ride_through_allowed, ride_end_allowed, maximum_speed_kph, and time windows).
  • edges-system-ids.txt.gz: Enumerated operator system_id list.

2. Configure bambam.toml for GBFS

To add a gbfs mode that rides over the bikeable road network (bike/edges-compass.csv.gz), update denver_buf/bambam.toml:

  1. Add "gbfs" to [label]:

    [label]
    type = "multimodal"
    max_trip_legs = 3
    modes = ["walk", "bike", "drive", "gbfs"]
    

    (Also add "gbfs" to available_modes in each [[search]] block’s multimodal traversal and constraint models.)

  2. Append the gbfs edge list to [graph] and [mapping] (reusing the bike network topology and geometries):

    [graph]
    edge_list = [
        { input_file = "walk/edges-compass.csv.gz" },
        { input_file = "bike/edges-compass.csv.gz" },
        { input_file = "drive/edges-compass.csv.gz" },
        { input_file = "bike/edges-compass.csv.gz" },
    ]
    vertex_list_input_file = "vertices-compass.csv.gz"
    
    [mapping]
    type = "edge"
    geometry = [
        { type = "from_linestrings", geometry_input_file = "walk/edges-geometries-enumerated.txt.gz" },
        { type = "from_linestrings", geometry_input_file = "bike/edges-geometries-enumerated.txt.gz" },
        { type = "from_linestrings", geometry_input_file = "drive/edges-geometries-enumerated.txt.gz" },
        { type = "from_linestrings", geometry_input_file = "bike/edges-geometries-enumerated.txt.gz" },
    ]
    
  3. Add a [[search]] block for the gbfs edge list:

    [[search]]
    traversal.type = "combined"
    traversal.models = [
        { type = "distance", distance_unit = "miles" },
        { type = "gbfs", zone_record_input_file = "gbfs/edges-gbfs-records.csv.gz", zone_geometry_input_file = "gbfs/edges-gbfs-geofences-enumerated.txt.gz", system_ids_input_file = "gbfs/edges-system-ids.txt.gz", default_speed = { speed = 16.0, speed_unit = "kph" } },
        { type = "time", time_unit = "minutes" },
        { type = "multimodal", this_mode = "gbfs", available_modes = ["walk", "bike", "drive", "gbfs"] },
    ]
    
    constraint.type = "combined"
    constraint.models = [
        { type = "gbfs", zone_record_input_file = "gbfs/edges-gbfs-records.csv.gz", zone_geometry_input_file = "gbfs/edges-gbfs-geofences-enumerated.txt.gz", system_ids_input_file = "gbfs/edges-system-ids.txt.gz" },
        { type = "multimodal", this_mode = "gbfs", available_modes = ["walk", "bike", "drive", "gbfs"] },
    ]
    
  4. Inject start_time and add gbfs to trip_modes:

    [[plugin.input_plugins]]
    type = "inject"
    format = "key_value"
    write_mode = "overwrite"
    key = "start_time"
    value = "2025-09-01T08:00:00Z"
    
    [plugin.input_plugins.modes.gbfs]
    multimodal_label = true
    max_trip_legs = 3
    constraints = [
        { type = "mode_time_limit", mode = "walk", max = 10.0, unit = "minutes" },
        { type = "allowed_modes", values = ["walk", "gbfs"] },
    ]
    

3. Run BAMBAM

cd denver_buf

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

3. What Happens

  1. Spatial Geofence Indexing:
    • On startup, BAMBAM builds a polygonal R-tree over gbfs/edges-gbfs-geofences-enumerated.txt.gz linked to the operator rules in gbfs/edges-gbfs-records.csv.gz.
  2. Boarding and Geofence Enforcement (gbfs Constraint & Traversal):
    • A traveler can begin a trip by walking (walk) and transition onto the gbfs network only at a vertex that lies inside an active GBFS zone where ride_start_allowed = true and ride_through_allowed = true.
    • Upon boarding, BAMBAM records the operator’s system_id in the search state so the rider stays on that operator’s fleet for the duration of the micromobility leg.
    • As the rider traverses links on the gbfs network, the gbfs constraint model verifies that each vertex remains inside a valid ride_through_allowed zone for that operator.
    • The gbfs traversal model sets the link travel speed to default_speed (e.g., \(16\text{ km/h}\)), capping it at maximum_speed_kph whenever the rider passes through a slow-speed geofence zone.
    • If a zone has ride_end_allowed = false (a no-parking zone), the rider can pass through it, but BAMBAM marks those vertices as invalid destinations for ending the micromobility leg.
  3. Output Aggregation:
    • Valid destinations reached via walk + gbfs within 10, 20, 30, and 40 minutes are aggregated into isochrones and opportunity counts in result.csv and result.json.