From b03a7b2568a06a8f24a8e877db8df929ed1d9210 Mon Sep 17 00:00:00 2001 From: Johannes Baumeister Date: Thu, 30 Apr 2026 14:51:40 +0200 Subject: [PATCH] Fix map synchronization for ALKIS DB layer by using state.ownerStatuses in style function --- app.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index 37ed564..b6fdba4 100644 --- a/app.js +++ b/app.js @@ -959,14 +959,13 @@ document.addEventListener('DOMContentLoaded', async () => { // Owner-Status-Coloring if (layerName.toLowerCase().includes('eigentümer') && state.ownerMapping) { const props = feature.properties; - // Fallback lookup case insensitive const getProp = (key) => props[key] || props[key.toLowerCase()] || props[key.toUpperCase()] || ''; const firstName = getProp(state.ownerMapping.firstName); const lastName = getProp(state.ownerMapping.lastName); const ownerName = `${firstName} ${lastName}`.trim().toLowerCase(); - const statusRaw = state.ownerStatuses[ownerName]; - const status = statusRaw ? statusRaw.toLowerCase() : ""; + const stored = state.ownerStatuses[ownerName]; + const status = (typeof stored === 'string' ? stored : (stored?.status || "")).toLowerCase(); if (status === 'gbr' || status === 'gesichert') fillColor = '#2ecc71'; if (status === 'external' || status === 'fremdplanung') fillColor = '#e74c3c'; @@ -1215,8 +1214,14 @@ document.addEventListener('DOMContentLoaded', async () => { const layer = L.geoJSON(geojson, { style: (feature) => { - const statusRaw = feature.properties.status; - const status = statusRaw ? statusRaw.toLowerCase() : ""; + const props = feature.properties; + const firstName = props.VNA || ''; + const lastName = props.GNA || ''; + const ownerName = `${firstName} ${lastName}`.trim().toLowerCase(); + + const stored = state.ownerStatuses[ownerName]; + const status = (typeof stored === 'string' ? stored : (stored?.status || props.status || "")).toLowerCase(); + let fillColor = 'transparent'; if (status === 'gbr' || status === 'gesichert') fillColor = '#2ecc71';