From ab35fc4df766b335bbbe3b1518de830e4fadd329 Mon Sep 17 00:00:00 2001 From: AI Assistant Date: Tue, 24 Mar 2026 16:33:57 +0200 Subject: [PATCH] fix(parcel-sync): red parcel fill for buildings without legal docs Instead of trying to color buildings directly (which requires an unreliable cadastralRef join), the parcel itself gets a strong red fill (opacity 0.45) when has_building=1 AND build_legal=0. Buildings sitting on these parcels are visually on a red background. Color scheme: - Red fill: building without legal docs - Light blue fill: building with legal - Green fill: enriched, no building - Yellow/amber fill: no enrichment Removed broken gis_cladiri_status overlay. Simplified legend. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../parcel-sync/components/tabs/map-tab.tsx | 140 +++++------------- 1 file changed, 41 insertions(+), 99 deletions(-) diff --git a/src/modules/parcel-sync/components/tabs/map-tab.tsx b/src/modules/parcel-sync/components/tabs/map-tab.tsx index 4533a67..8af9d15 100644 --- a/src/modules/parcel-sync/components/tabs/map-tab.tsx +++ b/src/modules/parcel-sync/components/tabs/map-tab.tsx @@ -203,7 +203,7 @@ export function MapTab({ siruta, sirutaValid }: MapTabProps) { maxzoom: 18, }); - // Data-driven fill: yellowish = no enrichment, dark green = enriched + // Data-driven fill: red = building no legal, green = enriched, yellow = no enrichment map.addLayer( { id: "l-ps-terenuri-fill", @@ -215,11 +215,33 @@ export function MapTab({ siruta, sirutaValid }: MapTabProps) { paint: { "fill-color": [ "case", + // Building without legal docs: RED fill (covers building too) + [ + "all", + ["==", ["get", "has_building"], 1], + ["==", ["get", "build_legal"], 0], + ], + "#ef4444", + // Building with legal: light blue + ["==", ["get", "has_building"], 1], + "#93c5fd", + // Enriched, no building: green ["==", ["get", "has_enrichment"], 1], - "#22c55e", // green: enriched - "#fbbf24", // amber/yellow: no enrichment + "#22c55e", + // No enrichment: amber/yellow + "#fbbf24", + ], + "fill-opacity": [ + "case", + // Stronger opacity for building issues so it shows through + [ + "all", + ["==", ["get", "has_building"], 1], + ["==", ["get", "build_legal"], 0], + ], + 0.45, + 0.25, ], - "fill-opacity": 0.3, }, }, "l-terenuri-fill", // below the transparent click-catcher @@ -268,77 +290,7 @@ export function MapTab({ siruta, sirutaValid }: MapTabProps) { } } - // ── Enrichment overlay for BUILDINGS ── - if (!map.getSource("gis_cladiri_status")) { - map.addSource("gis_cladiri_status", { - type: "vector", - tiles: [`${martinBase}/gis_cladiri_status/{z}/{x}/{y}`], - minzoom: 12, - maxzoom: 18, - }); - - // Hide base cladiri layers - try { - if (map.getLayer("l-cladiri-fill")) - map.setPaintProperty("l-cladiri-fill", "fill-opacity", 0); - } catch { - /* noop */ - } - - // Buildings: red fill = no legal, blue fill = legal, gray = unknown - map.addLayer( - { - id: "l-ps-cladiri-fill", - type: "fill", - source: "gis_cladiri_status", - "source-layer": "gis_cladiri_status", - minzoom: 14, - filter, - paint: { - "fill-color": [ - "case", - ["==", ["get", "build_legal"], 0], - "#ef4444", // red: no legal - ["==", ["get", "build_legal"], 1], - "#3b82f6", // blue: legal - "#6b7280", // gray: unknown (-1) - ], - "fill-opacity": 0.5, - }, - }, - "l-cladiri-line", - ); - - map.addLayer( - { - id: "l-ps-cladiri-line", - type: "line", - source: "gis_cladiri_status", - "source-layer": "gis_cladiri_status", - minzoom: 14, - filter, - paint: { - "line-color": [ - "case", - ["==", ["get", "build_legal"], 0], - "#dc2626", // dark red - "#1e3a5f", // dark blue - ], - "line-width": 0.8, - }, - }, - "l-cladiri-line", - ); - } else { - try { - if (map.getLayer("l-ps-cladiri-fill")) - map.setFilter("l-ps-cladiri-fill", filter); - if (map.getLayer("l-ps-cladiri-line")) - map.setFilter("l-ps-cladiri-line", filter); - } catch { - /* noop */ - } - } + // Buildings: keep base layer visible with siruta filter (already applied above) }, [mapReady, siruta, sirutaValid]); /* ── Boundary cross-check: load mismatched parcels ─────────── */ @@ -525,23 +477,22 @@ export function MapTab({ siruta, sirutaValid }: MapTabProps) { {/* Bottom-right: legend */}
-
Parcele
Fără enrichment
Cu enrichment @@ -549,32 +500,23 @@ export function MapTab({ siruta, sirutaValid }: MapTabProps) {
Cu clădire (legal)
Clădire fără acte
-
Clădiri
-
- - Legală -
-
- - Fără acte -
{mismatchSummary && (mismatchSummary.foreign > 0 || mismatchSummary.edge > 0) && ( <>
Limită UAT