feat(geoportal): building body labels (C1, C2, C3...) on map at zoom 17+

Extracts body suffix from cadastral_ref (e.g. "77102-C1" → "C1") and
displays as centered label on each building polygon. Only visible at
zoom 17+ to avoid clutter at lower zooms.

Applied to both geoportal map-viewer and parcel-sync map tab.
Uses siruta filter in parcel-sync tab.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-27 06:53:45 +02:00
parent 189e9a218a
commit acb9be8345
2 changed files with 27 additions and 0 deletions
@@ -58,6 +58,7 @@ const LAYER_IDS = {
terenuriLabel: "l-terenuri-label",
cladiriFill: "l-cladiri-fill",
cladiriLine: "l-cladiri-line",
cladiriLabel: "l-cladiri-label",
selectionFill: "l-selection-fill",
selectionLine: "l-selection-line",
drawPolygonFill: "l-draw-polygon-fill",
@@ -438,6 +439,31 @@ 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 body labels (C1, C2...) — only at high zoom to avoid clutter
map.addLayer({ id: LAYER_IDS.cladiriLabel, type: "symbol", source: SOURCES.cladiri, "source-layer": SOURCES.cladiri, minzoom: 17,
layout: {
"text-field": [
"case",
// Extract body suffix: "77102-C1" → "C1", "77102-C2" → "C2"
["has", "cadastral_ref"],
["case",
["!=", ["index-of", "-C", ["get", "cadastral_ref"]], -1],
["slice", ["get", "cadastral_ref"], ["+", ["index-of", "-C", ["get", "cadastral_ref"]], 1]],
"" // no "-C" suffix → no label
],
""
],
"text-font": ["Noto Sans Regular"],
"text-size": 10,
"text-anchor": "center",
"text-allow-overlap": false,
},
paint: {
"text-color": "#1e40af",
"text-halo-color": "#ffffff",
"text-halo-width": 1.2,
},
});
// === Selection highlight ===
map.addLayer({ id: LAYER_IDS.selectionFill, type: "fill", source: SOURCES.terenuri, "source-layer": SOURCES.terenuri, minzoom: 13,
@@ -46,6 +46,7 @@ const BASE_LAYERS = [
"l-terenuri-label",
"l-cladiri-fill",
"l-cladiri-line",
"l-cladiri-label",
];
/* ------------------------------------------------------------------ */