Open WillieMaddox opened 3 days ago
Sources no longer have a cache https://github.com/openlayers/openlayers/pull/16221 which removes the advantage of sharing sources. It affects all source types as XYZ and OSM are not (yet) subclasses of ImageTile.
No fix or workaround, sorry :disappointed:
I'm working on a project that combines two layer switchers with a swipe control, allowing users to switch map layers independently on the left and right sides. This setup provides flexibility without redundant data usage.
To optimize performance, tile sources are shared between layer switchers. For example, if the left side displays OpenStreetMap (OSM) and the right side is set to Google Maps, switching the right side to OSM won’t trigger additional downloads. The tiles are already cached from the initial download on the left side.
However, since the introduction of the
ImageTile
base class in OpenLayers version 10.0.0 and later, this tile-sharing functionality no longer works as expected. Before contacting the OpenLayers team, I wanted to ask here if there might be a potential fix or workaround within the ol-ext project.Below is an
index.html
and anindex.js
that should be sufficient to reproduce the issue.This
package.json
works:This one does not: