I am trying to create tiles for a few topojsons when they are read into a webpage. The idea is that once they are created, switching tile layers would be smoother for the user.
So essentially I do
let tiles = [];
let fileLayer = omnivore.topojson(file)
.on('ready', () => {
let geojson = fileLayer.toGeoJSON();
let tileLayer = L.vectorGrid.slicer( geojson, options)
}
tiles.push(tileLayer)
and then switch or add the layer I want to the map.
It works but I noticed that tiles are created only for the first file. When I switch or add the layer to the map it flashes a little and it takes a few ms to load. It would be nice to avoid this flashing. I looked into the fadeAnimation switch. It looks a little better but then I dug a little deeper and found that tiles exist only for the active layer... So it seems that tiles are created right before they are added to the map.
Is it possible to create and store a bunch of L.vectorGrid.slicers on load?
In a similar approach that uses leaflet 0.7 and L.CanvasTiles I was able to get smooth transitions from one layer to the next and would like to achieve the same with leaflet 1.x and L.vectorGrid
I am trying to create tiles for a few topojsons when they are read into a webpage. The idea is that once they are created, switching tile layers would be smoother for the user. So essentially I do
and then switch or add the layer I want to the map.
It works but I noticed that tiles are created only for the first file. When I switch or add the layer to the map it flashes a little and it takes a few ms to load. It would be nice to avoid this flashing. I looked into the
fadeAnimation
switch. It looks a little better but then I dug a little deeper and found that tiles exist only for the active layer... So it seems that tiles are created right before they are added to the map.Is it possible to create and store a bunch of
L.vectorGrid.slicer
s on load?In a similar approach that uses leaflet 0.7 and
L.CanvasTiles
I was able to get smooth transitions from one layer to the next and would like to achieve the same with leaflet 1.x andL.vectorGrid
Thanks!