I am using OpenLayers to create a map where I can Zoom and export the view (Following this exemple https://openlayers.org/en/latest/examples/export-map.html) This works fine, but what I need is a georeferenced image (ecw, geotiff) that users can use later on QGIS...

Does anyone knows how can I do this ?

  • you need to create a pngw (world file) of the image bounding box
    – Mapperz
    Apr 12, 2018 at 17:40
  • Thank you for answering. Any trick to do so ? I've been looking for a way to do this but to no avail..
    – Inss
    Apr 13, 2018 at 7:32

1 Answer 1


You can try the demo I've made.

It creates a zip with png files, associated pngw (world file) and prj files in a single zip when exporting.

The important part is for writing the pngw with below excerpt.

  var currentResolution = view.getResolution();
  var currentExtent = view.calculateExtent(); // Return [minx, miny, maxx, maxy]
  var pngwContent = [
    currentExtent[0] + currentResolution / 0.5,
    currentExtent[3] - currentResolution / 0.5

Then, you open it in QGIS (It's possible without unzipping). It will ask you to choose the projection (in this demo, with EPSG code 3857)

The quick result I got for an overview in QGIS using Wikimedia base maps.

Overview PNG + pngw from OpenLayers QGIS with Wikipedia basemap


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.