1

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?

5
  • Can you add what kind of raster source you use? And what about the WMS you included in the title? WMS service must be in EPSG:3857 (from the docs).
    – AndreJ
    Oct 10, 2014 at 7:13
  • I used a georeferenced rendered tif. The wms is that one gis.ktimanet.gr/wms/wmsopen/wmsserver.aspx? Oct 10, 2014 at 9:15
  • I used a georeferenced 3 band rendered tif.The wms is that one gis.ktimanet.gr/wms/wmsopen/wmsserver.aspx? . When the wms added to the project naothing apears in the preview window. To be honest i don't know the role of EPSG:3857. How the raster and wms must be to get it out? Oct 10, 2014 at 9:21
  • The WMS service only offers EPSG:4326 and WPSG:2100, so no chance. The plugin (or Openlayers3) will not reproject the WMS service. What CRS has the raster?
    – AndreJ
    Oct 10, 2014 at 11:07
  • Raster is also EPSG=2100. Oct 10, 2014 at 11:59

1 Answer 1

1

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.

7
  • Yes i noticed that no jpeg file is created. How you convert the file to jpg so as it is still georeferenced? Oct 10, 2014 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, 2014 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, 2014 at 19:13
  • See my extended answer. But I doubt that the WMS you mentioned supports EPSG:3857.
    – AndreJ
    Oct 11, 2014 at 4:36
  • 2
    QGIS can reproject the WMS internally from 4326 to 3857, but openlayers can not.
    – AndreJ
    Oct 11, 2014 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.