Skip to content

Commit 982decc

Browse files
committed
docs: update readme with latest feature (path review webapp)
1 parent f266c78 commit 982decc

File tree

1 file changed

+82
-2
lines changed

1 file changed

+82
-2
lines changed

README.md

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Train positioning library excels in post-processing the GNSS positions of your m
1616
- 🚄 **High Performance**: R-tree spatial indexing for O(log n) nearest-track search
1717
- 📍 **Accurate Projection**: Haversine distance and geodesic calculations with geo-rs
1818
- 🛤️ **Train Path Calculation**: Probabilistic path calculation through rail networks using topology
19+
- 🗺️ **Interactive Path Review**: Browser-based map webapp to visually review and edit calculated paths before projection
1920
- 🌍 **CRS Aware**: Explicit coordinate reference system handling (EPSG codes)
2021
-**Timezone Support**: RFC3339 timestamps with explicit timezone offsets; timezone-less ISO 8601 datetimes assumed UTC
2122
- 📊 **Multiple Formats**: CSV and GeoJSON input/output
@@ -47,6 +48,12 @@ tp-cli simple-projection --gnss positions.csv --network network.geojson --output
4748

4849
# Use pre-calculated path for projection
4950
tp-cli --gnss positions.csv --network network.geojson --train-path path.csv --output result.csv
51+
52+
# Review calculated path in browser before projection (integrated mode)
53+
tp-cli --gnss positions.csv --network network.geojson --output result.csv --review
54+
55+
# Launch standalone webapp to review/edit a path file
56+
tp-cli webapp --network network.geojson --train-path path.csv --output reviewed_path.csv
5057
```
5158

5259
### Debug Output
@@ -72,13 +79,70 @@ See **[DEBUG.md](DEBUG.md)** for a full description of the debug output files, t
7279
- **Scalability**: Sub-linear scaling with R-tree spatial indexing
7380
- **Memory**: Handles 10,000+ positions efficiently
7481

82+
## Train Path Review Webapp
83+
84+
The library ships a companion browser-based map webapp (`tp-webapp`) that lets you visually inspect and edit a calculated train path before using it for projection. No npm, no Node.js, no frontend build step required — the web assets are embedded in the binary at compile time using `rust-embed`.
85+
86+
### Modes
87+
88+
| Mode | Command | Use case |
89+
|------|---------|----------|
90+
| **Standalone** | `tp-cli webapp` | Review/edit an existing path file; save result to disk; server stays alive |
91+
| **Integrated** | `tp-cli … --review` | Pause the projection pipeline after path calculation; confirm or abort in the browser |
92+
93+
### What You Can Do in the Browser
94+
95+
- View all network segments on a Leaflet map (OpenStreetMap basemap, toggleable)
96+
- Path segments are highlighted with a colour-coded confidence scale
97+
- **Add** a netelement to the path by clicking it on the map — snapped to the correct topological position
98+
- **Remove** a path segment by clicking it — segment reverts to the default style
99+
- Sidebar shows an ordered list of segments with probability scores
100+
- **Dark mode** toggle (auto-activates from OS `prefers-color-scheme`)
101+
- **Close Tab** button for clean exit after the server shuts down
102+
103+
### Standalone Usage
104+
105+
```sh
106+
tp-cli webapp \
107+
--network network.geojson \
108+
--train-path path.csv \
109+
--output reviewed_path.csv
110+
```
111+
112+
A browser opens at `http://127.0.0.1:8765`. Click **Save** to write the reviewed path; the server stays alive for further edits. Press Ctrl+C when done.
113+
114+
The saved file is accepted directly by `--train-path`:
115+
116+
```sh
117+
tp-cli --gnss positions.csv --network network.geojson \
118+
--train-path reviewed_path.csv --output result.csv
119+
```
120+
121+
### Integrated Usage
122+
123+
```sh
124+
tp-cli --gnss positions.csv --network network.geojson \
125+
--output result.csv --review
126+
```
127+
128+
1. CLI calculates the train path
129+
2. Browser opens automatically — review and edit the path
130+
3. Click **Confirm** → path artifact saved as `result-path.csv`; projection continues
131+
4. Click **Abort** → CLI exits with non-zero code
132+
133+
### Build Without Web Server
134+
135+
```sh
136+
cargo build --package tp-cli --no-default-features
137+
```
138+
75139
## Project Structure
76140

77141
```
78142
tp-lib/ # Rust workspace root
79143
├── tp-core/ # Core Rust library
80144
│ ├── src/
81-
│ │ ├── models/ # Data models (GnssPosition, Netelement, ProjectedPosition)
145+
│ │ ├── models/ # Data models (GnssPosition, Netelement, ProjectedPosition, PathOrigin)
82146
│ │ ├── projection/ # Projection algorithms (geom, spatial indexing)
83147
│ │ ├── path/ # Train path calculation (candidate, probability, graph, viterbi)
84148
│ │ ├── io/ # Input/output (CSV, GeoJSON, Arrow)
@@ -90,6 +154,7 @@ tp-lib/ # Rust workspace root
90154
│ │ └── integration/ # Integration tests
91155
│ └── benches/ # Performance benchmarks
92156
├── tp-cli/ # Command-line interface
157+
├── tp-webapp/ # Interactive path review web server (axum + Leaflet.js)
93158
└── tp-py/ # Python bindings (PyO3)
94159
```
95160

@@ -383,13 +448,28 @@ xdg-open target/doc/index.html # Linux
383448

384449
### Specification Documents
385450

451+
**Feature 001 — GNSS Projection**
386452
- [Feature Specification](specs/001-gnss-projection/spec.md)
387453
- [Implementation Plan](specs/001-gnss-projection/plan.md)
388454
- [Data Model](specs/001-gnss-projection/data-model.md)
389455
- [CLI Contract](specs/001-gnss-projection/contracts/cli.md)
390-
- [API Contracts](specs/001-gnss-projection/contracts/)
391456
- [Tasks](specs/001-gnss-projection/tasks.md)
392457

458+
**Feature 002 — Train Path Calculation**
459+
- [Feature Specification](specs/002-train-path-calculation/spec.md)
460+
- [Implementation Plan](specs/002-train-path-calculation/plan.md)
461+
- [Data Model](specs/002-train-path-calculation/data-model.md)
462+
- [Tasks](specs/002-train-path-calculation/tasks.md)
463+
464+
**Feature 003 — Train Path Review Webapp**
465+
- [Feature Specification](specs/003-path-review-webapp/spec.md)
466+
- [Implementation Plan](specs/003-path-review-webapp/plan.md)
467+
- [Data Model](specs/003-path-review-webapp/data-model.md)
468+
- [REST API Contract](specs/003-path-review-webapp/contracts/api.md)
469+
- [CLI Contract](specs/003-path-review-webapp/contracts/cli.md)
470+
- [Quickstart](specs/003-path-review-webapp/quickstart.md)
471+
- [Tasks](specs/003-path-review-webapp/tasks.md)
472+
393473
### CI/CD & Workflows
394474

395475
This project uses automated workflows for continuous integration and deployment:

0 commit comments

Comments
 (0)