From 4c1ffe3d01cb66d43c411259c7e80a66122742fd Mon Sep 17 00:00:00 2001 From: AI Assistant Date: Fri, 27 Mar 2026 07:11:56 +0200 Subject: [PATCH] =?UTF-8?q?fix(geoportal):=20building=20labels=20C1/C2=20?= =?UTF-8?q?=E2=80=94=20simpler=20expression=20+=20minzoom=2016?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous index-of expression wasn't rendering. Simplified to use filter with index-of on dash + slice from dash position. Also lowered minzoom from 17 to 16. Added diagnostic log in enrichment for building cross-ref count to debug HAS_BUILDING=0 cases. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../geoportal/components/map-viewer.tsx | 30 +++++++++---------- .../parcel-sync/services/enrich-service.ts | 4 +++ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/modules/geoportal/components/map-viewer.tsx b/src/modules/geoportal/components/map-viewer.tsx index 0abee83..3a62c23 100644 --- a/src/modules/geoportal/components/map-viewer.tsx +++ b/src/modules/geoportal/components/map-viewer.tsx @@ -440,28 +440,28 @@ export const MapViewer = forwardRef( 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, + // 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], + ], 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-field": ["slice", + ["coalesce", ["get", "cadastral_ref"], ""], + ["+", ["index-of", "-", ["coalesce", ["get", "cadastral_ref"], ""]], 1], ], "text-font": ["Noto Sans Regular"], - "text-size": 10, + "text-size": 11, "text-anchor": "center", - "text-allow-overlap": false, + "text-allow-overlap": true, + "text-ignore-placement": false, }, paint: { - "text-color": "#1e40af", + "text-color": "#1e3a8a", "text-halo-color": "#ffffff", - "text-halo-width": 1.2, + "text-halo-width": 1.5, }, }); diff --git a/src/modules/parcel-sync/services/enrich-service.ts b/src/modules/parcel-sync/services/enrich-service.ts index f14a502..d2e1ec5 100644 --- a/src/modules/parcel-sync/services/enrich-service.ts +++ b/src/modules/parcel-sync/services/enrich-service.ts @@ -298,6 +298,10 @@ export async function enrichFeatures( if (baseRef) add(baseRef); } + console.log( + `[enrich] siruta=${siruta}: ${terenuri.length} terenuri, ${cladiri.length} cladiri in DB, ${buildingMap.size} chei in buildingMap`, + ); + // ── Fetch immovable list from eTerra ── push({ phase: "Descărcare listă imobile", downloaded: 0 }); const immovableListById = new Map();