fix: hide dwelling layer control

This commit is contained in:
2026-07-23 02:19:22 +01:00
parent a0566b1225
commit 1d4d09ff5e
+11 -4
View File
@@ -520,7 +520,9 @@ async function loadLayers() {
try { try {
const capabilities = await loadCapabilities(); const capabilities = await loadCapabilities();
availableLayers = extractLayers(capabilities); availableLayers = extractLayers(capabilities);
selectedLayers = availableLayers.map((layer) => layer.name); selectedLayers = availableLayers
.filter((layer) => !isInternalLayer(layer.name))
.map((layer) => layer.name);
renderLayerList(); renderLayerList();
syncSelectedLayers(); syncSelectedLayers();
@@ -579,9 +581,10 @@ function extractLayers(xmlText) {
} }
function renderLayerList() { function renderLayerList() {
els.layerCount.textContent = String(availableLayers.length); const userVisibleLayers = availableLayers.filter((layer) => !isInternalLayer(layer.name));
els.layerCount.textContent = String(userVisibleLayers.length);
if (!availableLayers.length) { if (!userVisibleLayers.length) {
els.layerList.className = "layer-list empty"; els.layerList.className = "layer-list empty";
els.layerList.textContent = "No published layers were returned by the service."; els.layerList.textContent = "No published layers were returned by the service.";
return; return;
@@ -590,7 +593,7 @@ function renderLayerList() {
els.layerList.className = "layer-list"; els.layerList.className = "layer-list";
els.layerList.replaceChildren(); els.layerList.replaceChildren();
availableLayers.forEach((layer) => { userVisibleLayers.forEach((layer) => {
const label = document.createElement("label"); const label = document.createElement("label");
label.className = "layer-item"; label.className = "layer-item";
@@ -631,6 +634,10 @@ function syncSelectedLayers() {
); );
} }
function isInternalLayer(name) {
return unqualifiedLayerName(name) === unqualifiedLayerName(DWELLING_PARCEL_LAYER_NAME);
}
async function loadDwellingParcels() { async function loadDwellingParcels() {
const publishedDwellingLayer = availableLayers.find( const publishedDwellingLayer = availableLayers.find(
(layer) => unqualifiedLayerName(layer.name) === unqualifiedLayerName(DWELLING_PARCEL_LAYER_NAME), (layer) => unqualifiedLayerName(layer.name) === unqualifiedLayerName(DWELLING_PARCEL_LAYER_NAME),