diff --git a/src/modules/geoportal/components/map-viewer.tsx b/src/modules/geoportal/components/map-viewer.tsx index 96cd423..0abee83 100644 --- a/src/modules/geoportal/components/map-viewer.tsx +++ b/src/modules/geoportal/components/map-viewer.tsx @@ -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( 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, diff --git a/src/modules/parcel-sync/components/tabs/map-tab.tsx b/src/modules/parcel-sync/components/tabs/map-tab.tsx index 1c72065..1703a4b 100644 --- a/src/modules/parcel-sync/components/tabs/map-tab.tsx +++ b/src/modules/parcel-sync/components/tabs/map-tab.tsx @@ -46,6 +46,7 @@ const BASE_LAYERS = [ "l-terenuri-label", "l-cladiri-fill", "l-cladiri-line", + "l-cladiri-label", ]; /* ------------------------------------------------------------------ */