perf: hide basemap boundaries, remove UAT layers, optimize Martin minzoom
Basemap cleanup (after map load): - Hide OpenFreeMap boundary/admin layers (redundant with our UATs) - Keep city/town place labels, remove village-level - Hide our Martin UAT layers (not needed in ParcelSync — filtered by siruta) Martin tile optimization: - gis_terenuri_status minzoom: 10 → 13 (parcels not visible below 13) - gis_cladiri_status minzoom: 12 → 14 (buildings not visible below 14) - Prevents unnecessary tile fetches at low zoom levels Applied to both ParcelSync Harta tab and Portal map. Requires docker restart martin. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user