Files
osmWorkflow/.trellis/tasks/08-17-native-road-center-line-styles/design.md

2.5 KiB

Native Road Centre-Line Style Overrides Design

Architecture

Workbench selects a generated centre-line dash
  -> segment_id identifies the logical road segment
  -> staged center-line-style override
  -> native-road-overrides.json
  -> compileCenterLines resolves default or effective style
  -> center_lines.geojson polygons with style fields
  -> Workbench / Blender / Cesium

The authoritative edit is a new override kind, not a mutation of center_lines.geojson. It has a deterministic ID based on segmentId, so a later recompilation replaces the segment's style rather than accumulating records.

Override Contract

{
  "id": "道路中心线:segment:way/123/1",
  "kind": "center-line-style",
  "segmentId": "segment:way/123/1",
  "color": "yellow",
  "pattern": "dashed"
}

validateOverrides() accepts only known model segment IDs and the finite string enums yellow|white and dashed|solid. A style override applies once to the paired forward/backward native roads for that segment. The existing schema version remains native-road-overrides/v1 because this is an additive kind and old files remain valid.

Geometry and Material

  • Default remains yellow dashed: 2m dash, 2m gap, 0.25m width.
  • solid generates deterministic adjacent 2m pieces with no gap. Pieces still undergo the same junction cutback and control-marking exclusion as dashed lines; this avoids creating a solid polygon across an excluded crossing.
  • Style fields color, pattern, dash_length_m, dash_gap_m, and effective_style are stored on every generated polygon.
  • Blender currently maps all center_lines to one yellow material, so the native adapter must support a white centre-line material route without changing legacy osm2streets layers. The route must preserve the existing yellow material for default and yellow overrides.

Workbench UX

Selecting a centre-line dash shows a compact Chinese style panel in the existing form area. A select control presents the four named choices. Choosing one stages an override; the existing 保存 / 保存并重新生成 actions remain the only persistence and generation actions. The panel also shows whether the style is default or overridden and identifies the native road segment.

Compatibility and Rollback

Unedited segments generate byte-compatible geometry style defaults apart from the added style properties. Oneway/service filtering and control priority are unchanged. Selecting --road-provider osm2streets remains a full rollback.