From 49a239006da9f631cf429f9c0687147e69575e01 Mon Sep 17 00:00:00 2001 From: AI Assistant Date: Fri, 27 Mar 2026 07:57:45 +0200 Subject: [PATCH] =?UTF-8?q?fix(geoportal):=20simplify=20building=20labels?= =?UTF-8?q?=20=E2=80=94=20show=20full=20cadastral=5Fref?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous index-of/slice expression wasn't rendering. Simplified to just show the full cadastral_ref (e.g. "77102-C1") as-is. MapLibre auto-hides overlapping labels. This is a diagnostic step to verify the tile property is accessible. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../geoportal/components/map-viewer.tsx | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/modules/geoportal/components/map-viewer.tsx b/src/modules/geoportal/components/map-viewer.tsx index 3a62c23..733e51a 100644 --- a/src/modules/geoportal/components/map-viewer.tsx +++ b/src/modules/geoportal/components/map-viewer.tsx @@ -439,24 +439,23 @@ 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 - // cadastral_ref format: "77102-C1" → show "C1" - // Uses regex-like approach: if contains "-", show everything after last "-" - map.addLayer({ id: LAYER_IDS.cladiriLabel, type: "symbol", source: SOURCES.cladiri, "source-layer": SOURCES.cladiri, minzoom: 16, - filter: ["all", - ["has", "cadastral_ref"], - ["!=", ["index-of", "-", ["coalesce", ["get", "cadastral_ref"], ""]], -1], - ], + // Building body labels (C1, C2...) — visible at high zoom + // cadastral_ref = "77102-C1" → display "C1" + map.addLayer({ + id: LAYER_IDS.cladiriLabel, + type: "symbol", + source: SOURCES.cladiri, + "source-layer": SOURCES.cladiri, + minzoom: 16, + filter: ["has", "cadastral_ref"], layout: { - "text-field": ["slice", - ["coalesce", ["get", "cadastral_ref"], ""], - ["+", ["index-of", "-", ["coalesce", ["get", "cadastral_ref"], ""]], 1], - ], + // Simple approach: show full cadastral_ref, let the user see "77102-C1" + // MapLibre will auto-hide overlapping labels + "text-field": ["get", "cadastral_ref"], "text-font": ["Noto Sans Regular"], - "text-size": 11, + "text-size": 10, "text-anchor": "center", - "text-allow-overlap": true, - "text-ignore-placement": false, + "text-allow-overlap": false, }, paint: { "text-color": "#1e3a8a",