diff --git a/index.html b/index.html index d018046..474310c 100644 --- a/index.html +++ b/index.html @@ -2820,12 +2820,30 @@ let gj = sanitize(await res.json()); if (gj.features.length > 0) { const c = gj.features[0].geometry.coordinates; - if (Math.abs(Array.isArray(c[0]) ? c[0][0] : c[0]) > 1000) gj = transformGeoJSON(gj, "EPSG:25832", "EPSG:4326"); + // Better detect nested multi-polygons + const firstCoord = Array.isArray(c[0]) ? (Array.isArray(c[0][0]) ? c[0][0][0] : c[0][0]) : c[0]; + if (Math.abs(firstCoord) > 1000) gj = transformGeoJSON(gj, "EPSG:25832", "EPSG:4326"); } - updateUsageLayer(gj); + state.usage = gj; + updateUsageLayer(); } } catch (e) { console.error("[V3-Sync] Usage Error:", e); } + // 4. WEA Standorte + try { + const res = await fetch(`${API_BASE}/wea`); + if (res.ok) { + let gj = sanitize(await res.json()); + if (gj.features.length > 0) { + const c = gj.features[0].geometry.coordinates; + const firstCoord = Array.isArray(c) ? c[0] : 0; + if (Math.abs(firstCoord) > 1000) gj = transformGeoJSON(gj, "EPSG:25832", "EPSG:4326"); + } + state.wea = gj; + updateWEALayer(); + } + } catch (e) { console.error("[V3-Sync] WEA Error:", e); } + console.log("[V3-Sync] Daten-Ladevorgang abgeschlossen."); if (indicator) indicator.classList.remove('active'); isLoading = false;