Search code examples
openlayers-3

How to position an image in OpenLayers 3 map?


I have a png image of other map that I know the original bounding box and the original projection. This image is 400x400 large but I have control over its width and height and can generate any size I want.

How can I position this image over my OL map in the correct location?

Both have same SRID.


Solution

  • Sorry guys. I need to learn to search a little more before ask.

            var imageLayer = new ol.layer.Image({
                source: new ol.source.ImageStatic({
                    url: 'http://localhost:8080/mclm/img/export.png',
                    projection: 'EPSG:4326',
                    imageExtent: [-44,-23,-42,-21]  
                })
            });