-
Notifications
You must be signed in to change notification settings - Fork 466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Layer Switcher and Swipe Tile Sharing Broken with OpenLayers 10.0.0+ #1112
Comments
Sources no longer have a cache openlayers/openlayers#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 😞 |
A workaround would be to have a layer switcher option which used layer opacity instead of the visible property to switch the visibility e.g. in https://openlayers.org/en/latest/examples/bing-maps.html change the code to
Even without the |
@mike-000 I am not sure how to implement your workaround in my example above. The swipe control handles which layers are displayed by adding / removing layers based on which layerswitcher is toggled; the left layerswitcher controls which layers are visible on the left side and the right layerswitcher controls which layers are visible on the right. |
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:
The text was updated successfully, but these errors were encountered: