Skip to content

ADR-0015: Shared map layer colors

  • Status: accepted
  • Datum: 2026-08-26
  • Phase: P2 / Map
  • Lastenheft: ED-13, DASH-01 (read-only geometries; display config is shared)

Kontext

Editor and Dashboard both draw Planung, Normierung, Produkte and nested product kinds on OpenLayers MVT layers. Until now each client invented a stroke color (theme tokens vs OL defaults), so the same feature looked different and operators could not set a legend.

Entscheidung

One catalog table map_layer_colors keyed by (scope, code) where scope is stage or kind and color is #rrggbb. Both clients read GET /map/layer-colors (and the dashboard layer-tree embeds the same values). Operators with can_edit set a swatch via PUT /map/layer-colors/{scope}/{code}. Maps style strokes/points from that hex; they never write geometry.

Begründung

Stages and kinds are both layer identities in the tree — not a new center table named after Planung. A single swatch table accepts a new kind without a migration. Hex is the native value of <input type="color"> and works in OpenLayers without a style server. Global (not per-project) keeps the legend identical on every project map.

Verworfene Alternativen

Alternative Warum verworfen
map_layers.style_json per project × geom Too many rows; dashboard tree is stage/kind, not per geom_kind; operators would re-color every project
Color column only on geo_object_kinds Stages are not kinds; would still need a second store
CSS theme tokens only (--primary etc.) Cannot pick a custom legend; dark theme would silently recolor GIS layers
Mapbox/ol-mapbox-style document in object storage Extra artifact, no click-to-pick in the layer panel, overkill for ~10 swatches

Folgen

Dashboard layer panel and editor modus/product UI show a clickable swatch. Readers and customers see colors but cannot PUT. QGIS still uses its own layer_styles; this catalog is for the two Linetra maps.