Skip to content

Add OSM network generation tool - #107

Merged
Xuan-1998 merged 1 commit into
Xuan-1998:multi-gpu-multimodefrom
jayzou3773:codex/issue-106-osm-network-tests
Aug 17, 2026
Merged

Xuan-1998 merged 1 commit into
Xuan-1998:multi-gpu-multimodefrom
jayzou3773:codex/issue-106-osm-network-tests

Conversation

@jayzou3773

@jayzou3773 jayzou3773 commented Aug 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds an OpenStreetMap network generation tool for LPSim. The tool converts live OSM data or an offline GraphML file into the current LPSim nodes.csv and edges.csv schemas.

Closes #106

Changes

  • Add place-based and bounding-box OSM downloads
  • Add offline GraphML input for reproducible workflows
  • Filter unusable edges and select a configurable connected component
  • Normalize speed units, lane counts, and parallel directed edges
  • Generate deterministic dense node indices and edge IDs
  • Preserve 64-bit OSM identifiers
  • Add the lpsim-network command and usage documentation
  • Add six offline acceptance tests

Usage

pip install -e '.[network]'

lpsim-network \
  --place "Berkeley, California, USA" \
  --output data/berkeley

The command produces:

data/berkeley/nodes.csv
data/berkeley/edges.csv

Testing

python -m pytest -q tests/test_generate_network.py
......                                                                   [100%]
6 passed in 1.11s

Additional checks:

  • Ruff passed
  • Black check passed
  • Python byte-compilation passed
  • Wheel build and console entry-point inspection passed

The automated tests cover:

  • CLI input modes
  • Exact output schemas
  • Dense node and edge identifiers
  • 64-bit OSM identifiers
  • Connected-component selection
  • Parallel-edge normalization
  • Speed and lane normalization
  • Deterministic byte-for-byte output
  • Demand-generation compatibility
  • Spatial-partition compatibility

Live OSM validation

A live bounding-box download generated:

  • 55 nodes
  • 125 directed edges
  • 100 valid demand trips
  • 2 valid spatial partitions containing all 55 nodes

Compatibility

  • Existing LPSim behavior and CSV loading are unchanged
  • No CI workflow changes are included
  • Live OSM generation requires Python 3.9+ and the optional network dependencies
  • Offline automated tests do not require network access

Limitations

  • Live downloads depend on OSM Overpass availability
  • Turn restrictions and traffic signals are not exported as separate simulation attributes

Comment thread tests/test_generate_network.py
@Xuan-1998
Xuan-1998 force-pushed the codex/issue-106-osm-network-tests branch from c36f5dc to b70a3e9 Compare August 17, 2026 04:44
@Xuan-1998
Xuan-1998 merged commit 2fc388a into Xuan-1998:multi-gpu-multimode Aug 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recent map generation script for OSM extraction?

2 participants