osm edits

This commit is contained in:
2026-04-27 16:03:21 +05:30
parent 71c6798e53
commit 1f70e01d89
8 changed files with 1594 additions and 16 deletions

View File

@@ -96,11 +96,47 @@ Range assets (start / mid / end) translate as a rigid body — all three vertice
## OSM road editing
### Modes
- **OSM tools…** modal — generate roads for the visible bbox (Overpass), import existing GeoJSON, export current roads, prune small road classes.
- **OSM edit mode** — drag any road's vertex to refine the centerline. Markers are gated by zoom ≥ 14 and capped at 80 vertices / 40 ghost dots per viewport so the map stays responsive.
- **Flip road direction** — cycle a road's `oneway` between 0 / 1 / -1 when it's wrong.
- **Edit OSM roads** button — toggles OSM edit mode. While on, every other layer is dimmed and only OSM roads are interactive.
- **Lane offset (m)** — controls the parallel offset used by snap-to-road. Range 0.130 m.
### Picking a road to edit
1. Turn on **Edit OSM roads** (right panel → Data section).
2. Zoom in to **z ≥ 14** — vertex handles only render at that zoom or deeper, to keep the map responsive.
3. Click any road. Its yellow `•` vertex pins appear; other roads stay un-pinned. The selected road's id is shown in the OSM-edit panel.
### Modifying a road
- **Drag a yellow `•` pin** — moves that vertex to wherever you drop it. The change is saved immediately.
- **Click a yellow `+` ghost pin** between two vertices — inserts a new vertex at that midpoint. Useful when an OSM segment is too sparse for the curve.
- **Flip direction** — cycles `oneway` through forward (`1`) → reverse (`-1`) → undirected (`0`). Use when OSM has the heading wrong on a divided road.
### Deleting vertices
Two tools, depending on scope:
**A. Surgical — Shift-click + Del**
1. Hold **Shift** and click a vertex pin → it turns red with an `✕`.
2. Repeat to mark more.
3. Press **Del** (or Backspace) → all marked vertices are removed in one shot.
4. The "Currently marked: N" label in the panel shows how many you've flagged. **Clear marks** unselects without deleting.
5. Shift-click a marked vertex again to unmark it individually.
6. The road must keep ≥ 2 vertices; the backend rejects deletes that would break that.
**B. Sweeping — Simplify by tolerance**
1. Use the **Simplify (m)** slider in the panel (0.520 m, default 2 m). Higher = more aggressive.
2. Click **Simplify this road**. Runs Douglas-Peucker on the polyline: any vertex within tolerance of the simplified line is dropped.
3. Status bar reports `before → after` vertex counts.
4. Try 12 m for cleanup, 5+ m for heavy decimation. Re-running with the same tolerance is idempotent.
### Deleting / flipping the whole road
- **Delete this road** — removes the road outright (with confirmation).
- **Deselect road** — exits the per-road editing tool but keeps OSM edit mode on.
### Notes
- OSM road edits are **not** undoable via the Recent actions panel — they're treated like reference-data tweaks. Be deliberate, especially with delete and simplify.
- Dragging a vertex triggers a single `update_osm_road` write per drag. Bulk delete and simplify are also single writes.
- After a vertex change, the road line refreshes in real time but the surrounding draggable pins re-render — slight visual flicker is normal.
---
## Snap-to-road