Fix map synchronization for ALKIS DB layer by using state.ownerStatuses in style function
Deploy Bürgerwind / deploy (push) Successful in 16s Details

This commit is contained in:
Johannes Baumeister 2026-04-30 14:51:40 +02:00
parent 79a9262329
commit b03a7b2568
1 changed files with 10 additions and 5 deletions

15
app.js
View File

@ -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';