fix(geoportal): show only building body suffix (C1, C2) instead of full cadastral_ref

Strip parcel number prefix from building labels — "291479-C1" now displays as "C1".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-27 21:32:38 +02:00
parent 0572097fb2
commit 236635fbf4
@@ -487,10 +487,23 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
paint: { "fill-color": "#3b82f6", "fill-opacity": 0.5 } });
map.addLayer({ id: LAYER_IDS.cladiriLine, type: "line", source: SOURCES.cladiri, "source-layer": SOURCES.cladiri, minzoom: 14,
paint: { "line-color": "#1e3a5f", "line-width": 0.6 } });
// Building cadastral_ref labels (e.g. C1, C2...)
// Building body labels — extract suffix after last dash (e.g. "291479-C1" → "C1")
map.addLayer({ id: LAYER_IDS.cladiriLabel, type: "symbol", source: SOURCES.cladiri, "source-layer": SOURCES.cladiri, minzoom: 16,
layout: {
"text-field": ["coalesce", ["get", "cadastral_ref"], ""],
"text-field": [
"case",
["has", "cadastral_ref"],
["let", "ref", ["get", "cadastral_ref"],
["let", "dashIdx", ["index-of", "-", ["var", "ref"]],
["case",
[">=", ["var", "dashIdx"], 0],
["slice", ["var", "ref"], ["+", ["var", "dashIdx"], 1]],
["var", "ref"],
],
],
],
"",
],
"text-font": ["Noto Sans Regular"],
"text-size": 9, "text-anchor": "center", "text-allow-overlap": false,
"text-max-width": 6,