Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down Expand Up @@ -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 <base64_openlr_code>`
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 <base64_openlr_code>`
- **Python**: `import openlr; ref = openlr.binary_decode("<base64_openlr_code>")` — 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?
Expand Down Expand Up @@ -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 |
Expand Down
21 changes: 11 additions & 10 deletions src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand All @@ -68,11 +68,12 @@ struct GeometryWithMetrics {
/// - WKB: Binary, LargeBinary, or BinaryView
/// - WKT: String, LargeString, or StringView
/// - GeoArrow native: List<Struct<x,y>> 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),
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -193,11 +194,11 @@ fn process_batch(
.and_then(|c| c.as_any().downcast_ref::<UInt64Array>());

let start_vertex = batch
.column_by_name("startVertex")
.column_by_name("startOsmNode")
.and_then(|c| c.as_any().downcast_ref::<Int64Array>());

let end_vertex = batch
.column_by_name("endVertex")
.column_by_name("endOsmNode")
.and_then(|c| c.as_any().downcast_ref::<Int64Array>());

let start_lat = batch
Expand Down
4 changes: 2 additions & 2 deletions src/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading