-
Notifications
You must be signed in to change notification settings - Fork 463
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
SwipeControl: Can't handle WebGLTile layer #723
Comments
Here's a repro, just save as .html file on your disk: <!DOCTYPE html>
<html>
<head>
<title>ol-ext: Swipe control</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="https://viglino.github.io/ol-ext/examples/style.css" />
<link rel="stylesheet" href="https://openlayers.org/en/latest/css/ol.css" />
<script type="text/javascript" src="https://openlayers.org/en/latest/build/ol.js"></script>
<link rel="stylesheet" href="https://viglino.github.io/ol-ext/dist/ol-ext.css" />
<script type="text/javascript" src="https://viglino.github.io/ol-ext/dist/ol-ext.js"></script>
</head>
<body >
<h1>ol-ext: Swipe control</h1>
<hr>
<div id="map" style="width:600px; height:400px;"></div>
<script type="text/javascript">
var osm = new ol.layer.Tile({
source: new ol.source.OSM()
});
var cog = new ol.source.GeoTIFF({
sources: [
{ url: 'https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/2020/S2A_36QWD_20200701_0_L2A/TCI.tif' }
]
});
var gl = new ol.layer.WebGLTile({
source: cog
});
var map = new ol.Map({
target: 'map',
view: cog.getView(),
layers: [ gl, osm ]
});
var ctrl = new ol.control.Swipe();
map.addControl(ctrl);
ctrl.addLayer(gl);
ctrl.addLayer(osm, true);
</script>
</body>
</html> |
I experimented a bit myself and tried something like
Unfortunately, the context returned by WebGL is read-only, so that doesn't work, it seems. |
2d context methods will not work a WebGL context, but it can be done with WebGL specific code https://openlayers.org/en/latest/examples/webgl-layer-swipe.html |
Oh, nice - and thanks. I never realized there are two swipe examples available: https://openlayers.org/en/latest/examples/index.html?q=swipe |
I've updated the Swipe Control to handle WebGLTile layers as well. |
This BUG still present using WebGLTile loading GeoTIFF images. Only displays one layer in one side `import Map from 'ol/Map.js'; const url1 = 'https://url of geotiff image 1'; const url2 = 'https://url of geotiff image 2'; const mapa = new Map({ var ctrl = new Swipe(); |
OpenLayers 6.8 (I think) introduced a new layer: WebGLTile
The SwipeControl works fine with all my other layers (I use), but once I add a GlTileLayer (with a GeoTiff source) it stops working correctly. It doesn't show the GlTileLayer but instead only shows the other layer on both sides.
The console shows this error:
The text was updated successfully, but these errors were encountered: