diff --git a/CLAUDE.md b/CLAUDE.md index 1140ee5..7e5e37a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -123,10 +123,10 @@ Key design decisions driven by this: ### Visualization Web App -The `~/openlr_benchmark` repo contains a FastAPI visualization app for debugging: +The `openlr_web` repo contains a FastAPI visualization app for debugging: ```bash -cd ~/openlr_benchmark +cd ~/openlr_web uv run uvicorn app:app --reload ``` @@ -158,7 +158,9 @@ The app shows: ### Debugging Approach -1. IMPORTANT: Never manually decode OpenLR references to LRPs using custom code: only use the Python or Rust libraries. You can decode from the command line like: `uvx --with openlr python -m openlr ` +1. IMPORTANT: Never manually decode OpenLR references to LRPs using custom code: only use the Python or Rust libraries. + - **CLI**: `uvx --with openlr python -m openlr ` + - **Python**: `import openlr; ref = openlr.binary_decode("")` — pass the base64 string directly (not raw bytes). Returns a `LineLocationReference` with `.points` (list of `LocationReferencePoint` with lon, lat, frc, fow, bear, lfrcnp, dnp) and `.poffs`/`.noffs`. 2. **Visualize the LRPs**: See where they land on the map 3. **Check candidate edges**: Are the correct roads being found? 4. **Verify connectivity**: Can A* find a path between candidate pairs? @@ -249,8 +251,8 @@ cd ~/openlr-web && uv pip install --reinstall ~/openlr-decoder/target/wheels/ope | Column | Type | Description | |--------|------|-------------| | `stableEdgeId` | uint64 | Unique edge identifier | -| `startVertex` | int64 | Start node ID | -| `endVertex` | int64 | End node ID | +| `startOsmNode` | int64 | Start node ID (OSM node; resolves barrier splits) | +| `endOsmNode` | int64 | End node ID (OSM node; resolves barrier splits) | | `startLat`, `startLon` | float64 | Start coordinates | | `endLat`, `endLon` | float64 | End coordinates | | `highway` | string | OSM highway tag | diff --git a/src/loader.rs b/src/loader.rs index 1d4b1dd..a245674 100644 --- a/src/loader.rs +++ b/src/loader.rs @@ -57,8 +57,8 @@ struct GeometryWithMetrics { /// /// Required columns: /// - `stableEdgeId` (UInt64): unique edge identifier -/// - `startVertex` (Int64): start node ID -/// - `endVertex` (Int64): end node ID +/// - `startOsmNode` (Int64): start node ID (OSM node, resolves barrier splits) +/// - `endOsmNode` (Int64): end node ID (OSM node, resolves barrier splits) /// - `startLat`, `startLon`, `endLat`, `endLon` (Float64): endpoint coordinates /// - `highway` (Utf8): OSM highway tag /// @@ -68,11 +68,12 @@ struct GeometryWithMetrics { /// - WKB: Binary, LargeBinary, or BinaryView /// - WKT: String, LargeString, or StringView /// - GeoArrow native: List> with geoarrow.linestring extension +/// pub fn road_network_schema() -> Schema { Schema::new(vec![ Field::new("stableEdgeId", DataType::UInt64, false), - Field::new("startVertex", DataType::Int64, false), - Field::new("endVertex", DataType::Int64, false), + Field::new("startOsmNode", DataType::Int64, false), + Field::new("endOsmNode", DataType::Int64, false), Field::new("startLat", DataType::Float64, false), Field::new("startLon", DataType::Float64, false), Field::new("endLat", DataType::Float64, false), @@ -87,8 +88,8 @@ pub fn road_network_schema() -> Schema { /// /// Expected columns: /// - stableEdgeId (STRING): unique edge identifier -/// - startVertex (INTEGER): start node ID -/// - endVertex (INTEGER): end node ID +/// - startOsmNode (INTEGER): start node ID (OSM node, resolves barrier splits) +/// - endOsmNode (INTEGER): end node ID (OSM node, resolves barrier splits) /// - startLat, startLon, endLat, endLon (FLOAT): endpoint coordinates /// - highway (STRING): OSM highway tag /// - lanes (INTEGER): number of lanes (optional, for FOW) @@ -118,8 +119,8 @@ pub fn load_network_from_parquet(path: &Path) -> Result<(RoadNetwork, SpatialInd /// /// Expected columns in each batch: /// - `stableEdgeId` (UInt64): unique edge identifier -/// - `startVertex` (Int64): start node ID -/// - `endVertex` (Int64): end node ID +/// - `startOsmNode` (Int64): start node ID (OSM node, resolves barrier splits) +/// - `endOsmNode` (Int64): end node ID (OSM node, resolves barrier splits) /// - `startLat`, `startLon`, `endLat`, `endLon` (Float64): endpoint coordinates /// - `highway` (Utf8): OSM highway tag /// - `lanes` (Int64, optional): number of lanes for FOW inference @@ -193,11 +194,11 @@ fn process_batch( .and_then(|c| c.as_any().downcast_ref::()); let start_vertex = batch - .column_by_name("startVertex") + .column_by_name("startOsmNode") .and_then(|c| c.as_any().downcast_ref::()); let end_vertex = batch - .column_by_name("endVertex") + .column_by_name("endOsmNode") .and_then(|c| c.as_any().downcast_ref::()); let start_lat = batch diff --git a/src/python.rs b/src/python.rs index 9eafc4f..0a3c9e3 100644 --- a/src/python.rs +++ b/src/python.rs @@ -56,8 +56,8 @@ impl PyRoadNetwork { /// /// Args: /// data: Arrow-compatible data with the road network schema. - /// Must have columns: stableEdgeId (uint64), startVertex (int64), - /// endVertex (int64), startLat/startLon/endLat/endLon (float64), + /// Must have columns: stableEdgeId (uint64), startOsmNode (int64), + /// endOsmNode (int64), startLat/startLon/endLat/endLon (float64), /// highway (string). Optional: lanes (int64), geometry (binary/WKB). /// /// Returns: