I am trying to export a QGIS_2.4 project to OpenLayers using the "Export to OpenLayers" plugin. I cannot export a raster layer. I am not getting any error message, but the raster layer doesn't appear in the preview window.

I have followed all rules in the plugin web page. Export to OpenLayers

Raster layers: They will be exported to JPEG files and reprojected into the default projection of the OL3 map to create (as EPSG:3857). The symbology is not used, so the layer must be a rendered image already. You can use the QGIS Save as rendered image functionality to get such an image from your data and symbology.

Any idea of what I am missing?


I'm afraid the plugin is currently rather experimental.

Loading the start page directly fails for me in Firefox because of security issues when loading file:/// adresses. If I place the files in a folder that I can access with my local Apache server as http://localhost, I get the start page working.

It is then able to display OSM background and vector layers.

Raster layers should be converted to jpg by the plugin, but I don't find that jpg in the folder it should be. I reprojected the raster layer using QGIS to EPSG:3857, converted it myself to jpg using GIMP and put it in the layers subfolder. It then appears in the browser as expected.

If I have a WMS service in my QGIS project that can serve EPSG:3857, the plugin creates an OL file that hangs up before displaying anything because of missing quotation marks around the url. This can be fixed manually in layers/layers.js:

var lyr_DLM = new ol.layer.Tile({
                        source: new ol.source.TileWMS(({
                          url: "http://www.wms.nrw.de/geobasis/wms_nw_dlm50",
                          params: {"LAYERS": "nw_dlm50", "TILED": "true"},
                        title: "DLM50"

The quotation marks after the url: were missing, everything else was written by the plugin. This may not work if the WMS server does not support EPSG:3857, or tiled WMS.

| improve this answer | |
  • Yes i noticed that no jpeg file is created. How you convert the file to jpg so as it is still georeferenced? – Παύλος Αποστόλου Oct 10 '14 at 18:33
  • The jpg needs no georeferencing. That information is written into the layers.js file. But you have to use Raster->Translate from EPSG:2100 to EPSG:3857 and a new name before starting the plugin. – AndreJ Oct 10 '14 at 18:49
  • Thanks!!!!!!! Raster works fine. Can you please tell me the syntax for the wms? Where to put the quotation marks in the layers.js? – Παύλος Αποστόλου Oct 10 '14 at 19:13
  • See my extended answer. But I doubt that the WMS you mentioned supports EPSG:3857. – AndreJ Oct 11 '14 at 4:36
  • 2
    QGIS can reproject the WMS internally from 4326 to 3857, but openlayers can not. – AndreJ Oct 11 '14 at 14:31

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.