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 {
const capabilities = await loadCapabilities();
availableLayers = extractLayers(capabilities);
selectedLayers = availableLayers.map((layer) => layer.name);
selectedLayers = availableLayers
.filter((layer) => !isInternalLayer(layer.name))
.map((layer) => layer.name);
renderLayerList();
syncSelectedLayers();
@@ -579,9 +581,10 @@ function extractLayers(xmlText) {
}
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.textContent = "No published layers were returned by the service.";
return;
@@ -590,7 +593,7 @@ function renderLayerList() {
els.layerList.className = "layer-list";
els.layerList.replaceChildren();
availableLayers.forEach((layer) => {
userVisibleLayers.forEach((layer) => {
const label = document.createElement("label");
label.className = "layer-item";
@@ -631,6 +634,10 @@ function syncSelectedLayers() {
);
}
function isInternalLayer(name) {
return unqualifiedLayerName(name) === unqualifiedLayerName(DWELLING_PARCEL_LAYER_NAME);
}
async function loadDwellingParcels() {
const publishedDwellingLayer = availableLayers.find(
(layer) => unqualifiedLayerName(layer.name) === unqualifiedLayerName(DWELLING_PARCEL_LAYER_NAME),