fix(geoportal): hide OpenFreeMap built-in boundary layers on load
OpenFreeMap Liberty/Dark styles include admin boundary layers that show even when our UAT toggle is off. Now hides all boundary/admin/border layers from the basemap style on map load. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -362,6 +362,14 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
|
|||||||
map.on("load", () => {
|
map.on("load", () => {
|
||||||
const m = resolvedMartinUrl;
|
const m = resolvedMartinUrl;
|
||||||
|
|
||||||
|
// Hide OpenFreeMap's built-in boundary/admin layers (we have our own)
|
||||||
|
for (const layer of map.getStyle().layers) {
|
||||||
|
const id = layer.id.toLowerCase();
|
||||||
|
if (id.includes("boundar") || id.includes("admin") || (id.includes("border") && !id.includes("water"))) {
|
||||||
|
try { map.setLayoutProperty(layer.id, "visibility", "none"); } catch { /* noop */ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// === UAT z0-5: very coarse — lines only ===
|
// === UAT z0-5: very coarse — lines only ===
|
||||||
map.addSource(SOURCES.uatsZ0, { type: "vector", tiles: [`${m}/${SOURCES.uatsZ0}/{z}/{x}/{y}`], minzoom: 0, maxzoom: 5 });
|
map.addSource(SOURCES.uatsZ0, { type: "vector", tiles: [`${m}/${SOURCES.uatsZ0}/{z}/{x}/{y}`], minzoom: 0, maxzoom: 5 });
|
||||||
map.addLayer({ id: LAYER_IDS.uatsZ0Line, type: "line", source: SOURCES.uatsZ0, "source-layer": SOURCES.uatsZ0, maxzoom: 5,
|
map.addLayer({ id: LAYER_IDS.uatsZ0Line, type: "line", source: SOURCES.uatsZ0, "source-layer": SOURCES.uatsZ0, maxzoom: 5,
|
||||||
|
|||||||
Reference in New Issue
Block a user