1

Is it possible to add a legend for Rasterlayer directly from the Qgis2Web Plugin or do I need to add the code manually? I added an image of an example (DEM raster) and a Vector Layer.

It doesn't matter if I choose leaflet or OL3, there is no option for any legend in this plugin as it seems. Also there seems to be no option for showing the raster value as a popup like there is for vector layers.

enter image description here

When exported the in the layer list it appears a legend for the vector layer, but for the raster it's just the name. enter image description here

If there is really no option for adding a legend via this plugin, could anybody help with adding a code manually? Which of the resulting file I need to change? enter image description here

  • I think this gis.stackexchange post describes the legend capabilities of Qgis2Web: gis.stackexchange.com/questions/179403/… If that doesn't answer your questions, you might need to add the code manually. – jbukoski Jul 25 '16 at 14:16
  • this question is about vector layer not about Raster! – Bennet Jul 25 '16 at 14:19
  • As far as I know, those are all of the legend capabilities qgis2web offers. Someone else may correct me here, but I'd recommend just adding the code manually. – jbukoski Jul 25 '16 at 14:39
  • Can you clarify what is not appearing? Does no entry appear in the layers list for your raster layer? Also, does this happen with OpenLayers 3 or Leaflet export, or both? – Tom Chadwin Jul 25 '16 at 15:42
  • I updated my question – Bennet Jul 26 '16 at 10:20
3

Yes, you are right - the layers list currently only shows the name of raster layers. Symbology and values could be added in the future, but they're not there now.

To achieve what you want manually, export and then edit the exported file. You'll have to use Leaflet format, as the OL3 layer switcher doesn't support symbology. Open index.html in a text editor and search for the line which starts L.control.layers(basemaps,{"your raster layer name".

Add whatever HTML you want to within the quotes ("your raster layer name" above) to add symbology/icons.

| improve this answer | |

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.