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:
+2
-2
@@ -100,7 +100,7 @@ postgres:
|
|||||||
geometry_column: geom
|
geometry_column: geom
|
||||||
srid: 3844
|
srid: 3844
|
||||||
bounds: [20.2, 43.5, 30.0, 48.3]
|
bounds: [20.2, 43.5, 30.0, 48.3]
|
||||||
minzoom: 10
|
minzoom: 13
|
||||||
maxzoom: 18
|
maxzoom: 18
|
||||||
properties:
|
properties:
|
||||||
object_id: text
|
object_id: text
|
||||||
@@ -120,7 +120,7 @@ postgres:
|
|||||||
geometry_column: geom
|
geometry_column: geom
|
||||||
srid: 3844
|
srid: 3844
|
||||||
bounds: [20.2, 43.5, 30.0, 48.3]
|
bounds: [20.2, 43.5, 30.0, 48.3]
|
||||||
minzoom: 12
|
minzoom: 14
|
||||||
maxzoom: 18
|
maxzoom: 18
|
||||||
properties:
|
properties:
|
||||||
object_id: text
|
object_id: text
|
||||||
|
|||||||
@@ -1242,6 +1242,36 @@ function HartaContent() {
|
|||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
}, [selectedSiruta]);
|
}, [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
|
// When map becomes ready, fitBounds ONCE per siruta
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!mapReady || !boundsRef.current || !selectedSiruta) return;
|
if (!mapReady || !boundsRef.current || !selectedSiruta) return;
|
||||||
|
|||||||
@@ -150,6 +150,48 @@ export function MapTab({ siruta, sirutaValid, sessionConnected, syncLocalCount,
|
|||||||
return () => clearInterval(check);
|
return () => clearInterval(check);
|
||||||
}, [sirutaValid, mapReady]);
|
}, [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 ──────────────────────────────────────── */
|
/* ── Fetch UAT bounds ──────────────────────────────────────── */
|
||||||
const prevBoundsSirutaRef = useRef("");
|
const prevBoundsSirutaRef = useRef("");
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user