diff --git a/martin.yaml b/martin.yaml index 86191fa..dd536e8 100644 --- a/martin.yaml +++ b/martin.yaml @@ -100,7 +100,7 @@ postgres: geometry_column: geom srid: 3844 bounds: [20.2, 43.5, 30.0, 48.3] - minzoom: 10 + minzoom: 13 maxzoom: 18 properties: object_id: text @@ -120,7 +120,7 @@ postgres: geometry_column: geom srid: 3844 bounds: [20.2, 43.5, 30.0, 48.3] - minzoom: 12 + minzoom: 14 maxzoom: 18 properties: object_id: text diff --git a/src/app/(portal)/portal/page.tsx b/src/app/(portal)/portal/page.tsx index e6349fb..dae2fb8 100644 --- a/src/app/(portal)/portal/page.tsx +++ b/src/app/(portal)/portal/page.tsx @@ -1242,6 +1242,36 @@ function HartaContent() { .catch(() => {}); }, [selectedSiruta]); + // Hide basemap admin boundaries + our UAT layers + const cleanedBasemapRef = useRef(false); + useEffect(() => { + if (!mapReady) { cleanedBasemapRef.current = false; return; } + if (cleanedBasemapRef.current) return; + const map = asMap(mapHandleRef.current); + if (!map) return; + cleanedBasemapRef.current = true; + try { + const style = (map as unknown as { getStyle(): { layers?: { id: string }[] } }).getStyle(); + if (style?.layers) { + for (const layer of style.layers) { + const id = layer.id.toLowerCase(); + if (id.includes("boundary") || id.includes("admin") || + (id.includes("place") && !id.includes("place-city") && !id.includes("place-town"))) { + map.setLayoutProperty(layer.id, "visibility", "none"); + } + } + } + } catch { /* noop */ } + const uatLayers = [ + "l-uats-z0-line", "l-uats-z5-fill", "l-uats-z5-line", + "l-uats-z8-fill", "l-uats-z8-line", "l-uats-z8-label", + "l-uats-z12-fill", "l-uats-z12-line", "l-uats-z12-label", + ]; + for (const lid of uatLayers) { + try { if (map.getLayer(lid)) map.setLayoutProperty(lid, "visibility", "none"); } catch { /* noop */ } + } + }, [mapReady]); + // When map becomes ready, fitBounds ONCE per siruta useEffect(() => { if (!mapReady || !boundsRef.current || !selectedSiruta) return; diff --git a/src/modules/parcel-sync/components/tabs/map-tab.tsx b/src/modules/parcel-sync/components/tabs/map-tab.tsx index 1656f1d..e378190 100644 --- a/src/modules/parcel-sync/components/tabs/map-tab.tsx +++ b/src/modules/parcel-sync/components/tabs/map-tab.tsx @@ -150,6 +150,48 @@ export function MapTab({ siruta, sirutaValid, sessionConnected, syncLocalCount, return () => clearInterval(check); }, [sirutaValid, mapReady]); + /* ── Hide basemap admin boundaries + our UAT layers (we use siruta filter) */ + const cleanedBasemapRef = useRef(false); + useEffect(() => { + if (!mapReady) { + cleanedBasemapRef.current = false; + return; + } + if (cleanedBasemapRef.current) return; + const map = asMap(mapHandleRef.current); + if (!map) return; + cleanedBasemapRef.current = true; + + // Hide OpenFreeMap admin boundary and place layers (redundant — we have our own UATs) + try { + const style = (map as unknown as { getStyle(): { layers?: { id: string }[] } }).getStyle(); + if (style?.layers) { + for (const layer of style.layers) { + const id = layer.id.toLowerCase(); + if ( + id.includes("boundary") || + id.includes("admin") || + (id.includes("place") && !id.includes("place-city") && !id.includes("place-town")) + ) { + map.setLayoutProperty(layer.id, "visibility", "none"); + } + } + } + } catch { + /* noop */ + } + + // Hide our Martin UAT layers (not needed when filtering by siruta) + const uatLayers = [ + "l-uats-z0-line", "l-uats-z5-fill", "l-uats-z5-line", + "l-uats-z8-fill", "l-uats-z8-line", "l-uats-z8-label", + "l-uats-z12-fill", "l-uats-z12-line", "l-uats-z12-label", + ]; + for (const lid of uatLayers) { + try { if (map.getLayer(lid)) map.setLayoutProperty(lid, "visibility", "none"); } catch { /* noop */ } + } + }, [mapReady]); + /* ── Fetch UAT bounds ──────────────────────────────────────── */ const prevBoundsSirutaRef = useRef(""); useEffect(() => {