I have had a need for a while to switch baselayers, so much thanks to those who contributed to the recent updates enabling this.
I have found a bug which I have recreated in the demo site. When the baselayer is switched and the sources are re-added to the map the source component does not reset the local reference to the sourceObj so when data in the source layer is updated it does not show up on the map. You can see this behavior in the below video:
We can fix this by having the GeoJSON component listen to the style.load event and update the sourceObj whenever it loads. I will create a PR momentarily to address this.
I have had a need for a while to switch baselayers, so much thanks to those who contributed to the recent updates enabling this.
I have found a bug which I have recreated in the demo site. When the baselayer is switched and the sources are re-added to the map the source component does not reset the local reference to the
sourceObj
so when data in the source layer is updated it does not show up on the map. You can see this behavior in the below video:https://github.com/dimfeld/svelte-maplibre/assets/34895686/2b494002-07fb-4a13-b6ef-1ecdbc09ff8d
We can fix this by having the
GeoJSON
component listen to thestyle.load
event and update thesourceObj
whenever it loads. I will create a PR momentarily to address this.