Skip to content

OMF Transportation Serialization logic#66

Merged
robfitzgerald merged 15 commits intomainfrom
yep/omf-transportation-compass
Dec 18, 2025
Merged

OMF Transportation Serialization logic#66
robfitzgerald merged 15 commits intomainfrom
yep/omf-transportation-compass

Conversation

@yamilbknsu
Copy link
Copy Markdown
Collaborator

In this PR, I implement the pipeline for serializing vertices and edges into compressed csv files. Crucially, I define TransportationCollection to be the downloaded set of connectors and segments that then gets transformed into a OmfGraphVectorized, which knows how to split segments into vertices and edges and how to write them into a csv.

This setup also allows for future implementations of splitting logic that go beyond just connectors.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a serialization pipeline for Overture Maps Foundation (OMF) transportation data. It introduces a TransportationCollection struct that downloads connectors and segments, transforms them into an OmfGraphVectorized structure, and writes vertices and edges to compressed CSV files in a format compatible with RouteE Compass.

Key changes:

  • Adds graph module with splitting logic to convert transportation segments into graph edges
  • Creates TransportationCollection to aggregate downloaded connectors and segments
  • Implements CSV serialization with gzip compression for vertices and edges
  • Adds CLI application scaffolding with a Download operation

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
rust/bambam-omf/src/lib.rs Exports new app and graph modules
rust/bambam-omf/src/graph/omf_graph.rs Core graph structure with CSV writing logic
rust/bambam-omf/src/graph/segment_split.rs Defines split logic for creating edges from segments
rust/bambam-omf/src/graph/serialize_ops.rs Helper functions for connector mapping and segment splitting
rust/bambam-omf/src/graph/vertex_serializable.rs Serialization format for vertices
rust/bambam-omf/src/graph/mod.rs Module exports for graph components
rust/bambam-omf/src/collection/record/transportation_segment.rs Adds distance calculation and makes fields public
rust/bambam-omf/src/collection/record/transportation_connector.rs Adds vertex conversion logic and makes id public
rust/bambam-omf/src/collection/record/transportation_collection.rs New struct to aggregate connectors and segments
rust/bambam-omf/src/collection/record/mod.rs Exports TransportationCollection
rust/bambam-omf/src/collection/mod.rs Re-exports transportation types
rust/bambam-omf/src/collection/error.rs Adds new error variants for serialization
rust/bambam-omf/src/bin/bambam_omf.rs CLI binary entry point
rust/bambam-omf/src/app/serialize_options.rs Unused configuration structs (not integrated)
rust/bambam-omf/src/app/omf_app.rs CLI app structure with hardcoded test values
rust/bambam-omf/src/app/mod.rs Module exports for app
rust/bambam-omf/Cargo.toml Adds dependencies for CLI, compression, and itertools

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if filepath.exists() && !overwrite {
return None;
}
let file = File::create(filepath).unwrap();
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File::create can fail if the directory doesn't exist or permissions are insufficient. Using unwrap() here will cause a panic instead of returning a proper error. This should return a Result and propagate the error properly using map_err, similar to how other errors are handled in write_compass.

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +49
let row_filter_config = RowFilterConfig::Bbox {
xmin: -105.254,
xmax: -105.197,
ymin: 39.733,
ymax: 39.784,
};

let collection = TransportationCollection::try_from_collector(
collector,
release,
Some(row_filter_config),
)?;
let vectorized_graph = OmfGraphVectorized::try_from_collection(collection, 0)?;
vectorized_graph.write_compass(Path::new("./"), true)?;
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded test/development values for production code. The bounding box coordinates (Golden, CO area) and output path ("./") are hardcoded in what appears to be production CLI code. These should be command-line arguments or configuration parameters to make the tool usable for different areas and output locations.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

@robfitzgerald robfitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! have a great holiday! 🎄


#[derive(Debug, Clone, Serialize, Deserialize, Subcommand)]
pub enum OmfOperation {
/// download all of the GTFS archives
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incorrect doc comment

robfitzgerald and others added 11 commits December 18, 2025 13:13
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…n.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@robfitzgerald robfitzgerald merged commit 3959dd6 into main Dec 18, 2025
1 check passed
@robfitzgerald robfitzgerald deleted the yep/omf-transportation-compass branch December 18, 2025 20:33
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.

3 participants