diff --git a/index.html b/index.html index feec7d1..8b4585e 100644 --- a/index.html +++ b/index.html @@ -1519,16 +1519,24 @@ const statusEl = document.getElementById('status-usage'); - // Filtering: Only show requested types - const requestedTypes = ['gehölz', 'wald', 'bahnverkehr', 'straßenverkehr', 'wohnbafläche', 'weg', 'fließgewässer', 'stehendes gewässer', 'gewässer']; + // Filtering: Expanded list and more robust matching + const requestedKeywords = [ + 'gehölz', 'wald', 'forst', 'bahn', 'verkehr', 'straße', 'baufläche', 'wohnbau', + 'weg', 'gewässer', 'wasser', 'grünland', 'landwirtsch', 'acker' + ]; + const filteredFeatures = state.usage.features.filter(f => { - const type = (f.properties.nutzart || f.properties.NUTZART || '').toLowerCase(); - return requestedTypes.some(rt => type.includes(rt)); + const props = f.properties; + const rawType = props.nutzart || props.NUTZART || props.bezeichnung || props.BEZEICHNUN || props.nutzungsart || ''; + const type = rawType.toLowerCase(); + return requestedKeywords.some(kw => type.includes(kw)); }); + console.log(`Nutzung-Layer: ${filteredFeatures.length} von ${state.usage.features.length} Objekten nach Filterung.`); + if (statusEl) { statusEl.innerText = `${filteredFeatures.length} Objekte`; - statusEl.style.color = 'var(--success)'; + statusEl.style.color = filteredFeatures.length > 0 ? 'var(--success)' : 'var(--warning)'; } layers.usage.clearLayers(); @@ -1537,10 +1545,11 @@ type: "FeatureCollection", features: filteredFeatures }); - } - - if (layers.usage.getBounds().isValid() && state.visibleLayers.usage && filteredFeatures.length > 0) { - map.fitBounds(layers.usage.getBounds()); + + if (layers.usage.getBounds().isValid() && filteredFeatures.length > 0) { + console.log("Zooming to Usage layer..."); + // map.fitBounds(layers.usage.getBounds()); // Optional: Auto-zoom to usage + } } }