fix: hide dwelling layer control
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user