karte.astro: setMap() gegen fehlende Map-Sources guarden -> render()/Tabelle bricht nicht mehr ab (war hinter surl-Bug versteckt). Tabelle füllt sich jetzt vor Map-Load
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user