fix(geoportal): building labels C1/C2 — simpler expression + minzoom 16

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) <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-27 07:11:56 +02:00
parent 4e67c29267
commit 4c1ffe3d01
2 changed files with 19 additions and 15 deletions
+15 -15
View File
@@ -440,28 +440,28 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
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,
},
});
@@ -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<string, any>();