More

Error placing a static image with OpenLayers 3?


Working with the last version of OpenLayers 3, I'm not able to load correctly a static image over the map. After some test (with similar configuration) I found that the image looks fine on OL2, while on OL3 it has a displacement of several kilometers, as you can see on the following image:

I've done a plunker with that example. Could it be a bug or I'm missing something? http://plnkr.co/lzAKNGdkXkz6ZCM9H6ml

/* OL3 */ var graphicOL3 = new ol.layer.Image({ source: new ol.source.ImageStatic({ url: 'https://raw.githubusercontent.com/VictorVelarde/ImagenEstuario/master/Composite.png">

Finally it was a bug of OL3 library. They resolved it on this ticket: https://github.com/openlayers/ol3/pull/4426 It's not yet implemented on the last release version (3.11.2) so if you face this problem you have to point to the master: http://openlayers.org/en/master/build/ol.js


Watch the video: Openlayers 6 Tutorial #6 - Layer Switcher (October 2021).