Fix frontend data loading for WEA and Usage layers
Deploy TrassenPlaner / deploy (push) Waiting to run
Details
Deploy TrassenPlaner / deploy (push) Waiting to run
Details
This commit is contained in:
parent
c5d488e5c1
commit
bf6183ce80
22
index.html
22
index.html
|
|
@ -2820,12 +2820,30 @@
|
||||||
let gj = sanitize(await res.json());
|
let gj = sanitize(await res.json());
|
||||||
if (gj.features.length > 0) {
|
if (gj.features.length > 0) {
|
||||||
const c = gj.features[0].geometry.coordinates;
|
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); }
|
} 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.");
|
console.log("[V3-Sync] Daten-Ladevorgang abgeschlossen.");
|
||||||
if (indicator) indicator.classList.remove('active');
|
if (indicator) indicator.classList.remove('active');
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue