From d74f91b4bbfc93c509e1d473371751b1c7f72c80 Mon Sep 17 00:00:00 2001 From: "Till (Cowork)" Date: Mon, 29 Jun 2026 14:39:10 +0000 Subject: [PATCH] =?UTF-8?q?karte.astro:=20setMap()=20gegen=20fehlende=20Ma?= =?UTF-8?q?p-Sources=20guarden=20->=20render()/Tabelle=20bricht=20nicht=20?= =?UTF-8?q?mehr=20ab=20(war=20hinter=20surl-Bug=20versteckt).=20Tabelle=20?= =?UTF-8?q?f=C3=BCllt=20sich=20jetzt=20vor=20Map-Load?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/karte.astro | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/karte.astro b/src/pages/karte.astro index 5380663..9c7d066 100644 --- a/src/pages/karte.astro +++ b/src/pages/karte.astro @@ -187,9 +187,12 @@ const jsonld={'@context':'https://schema.org','@type':'WebApplication',name:'Kü const map=new maplibregl.Map({container:'map',style:'https://tiles.openfreemap.org/styles/liberty',center:[9.6,50.6],zoom:4.4}); map.addControl(new maplibregl.NavigationControl(),'top-right'); function setMap(list){ + // Karte erst befüllen, wenn der Style geladen ist (sonst getSource()=undefined -> würde render() abbrechen) + const sAll=map.getSource('all'), sAv=map.getSource('av'); + if(!sAll||!sAv)return; const all={type:'FeatureCollection',features:list.map(s=>({type:'Feature',geometry:{type:'Point',coordinates:[s.lo,s.la]},properties:{}}))}; const av={type:'FeatureCollection',features:list.filter(s=>status(s)?.a).map(s=>({type:'Feature',geometry:{type:'Point',coordinates:[s.lo,s.la]},properties:{n:s.n,ci:s.ci,t:s.t||null}}))}; - map.getSource('all').setData(all);map.getSource('av').setData(av); + sAll.setData(all);sAv.setData(av); } function priceStrip(){ const el=$('#pricestrip');