1

How can I add a legend to a raster to the Globcover land cover dataset in QGIS without plugins?

The data can be found here http://due.esrin.esa.int/globcover/

Unfortunately, as far as I know, QGIS doesn't support the use of .lyr files as legend for classified raster datasets. For an import dataset I created a QGIS compatile legend file.

2
  • It is great to share your style, but I don't understand what your question is. Maybe you could post your text file as an answer to your own question in order to share this knowledge. Note that the more portable solution is to use a colormap.
    – radouxju
    Feb 5, 2015 at 7:00
  • Although this is a solution to my question I am quite sure there must be a more elegant way to get the legend in QGIS. The original files can be found here due.esrin.esa.int/globcover Do you know how to get the legend and colors running without using tedious mental copy pasting like I did in the example above?
    – RutgerH
    Feb 5, 2015 at 9:26

1 Answer 1

2

A possible, but not very elegant way to do is is to manually create a QGIS compatible legend .txt file.

  1. Save text below (>) as .txt
    1. add raster Globcover tif file
    2. right click properties
    3. Go to style
    4. select singleband pseudocolor
    5. load saved .txt file as colormap (N.B. Not as style)

(>) copy from here:

# QGIS Generated Color Map Export File
INTERPOLATION:DISCRETE
11,170,240,240,255,11 Post-flooding or irrigated croplands (or aquatic)
14,255,255,100,255,14 Rainfed croplands
20,220,240,100,255,20 Mosaic cropland (50-70%) / vegetation (grassland/shrubland/forest) (20-50%)
30,205,205,102,255,30 Mosaic vegetation (grassland/shrubland/forest) (50-70%) / cropland (20-50%) 
40,0,100,0,255,40 Closed to open (>15%) broadleaved evergreen or semi-deciduous forest (>5m)
50,0,160,0,255,50 Closed (>40%) broadleaved deciduous forest (>5m)
60,170,200,0,255,60 Open (15-40%) broadleaved deciduous forest/woodland (>5m)
70,0,60,0,255,70 Closed (>40%) needleleaved evergreen forest (>5m)
90,40,100,0,255,90 Open (15-40%) needleleaved deciduous or evergreen forest (>5m)
100,120,130,0,255,100 Mosaic forest or shrubland (50-70%) / grassland (20-50%)
110,140,160,0,255,110 Mosaic forest or shrubland (50-70%) / grassland (20-50%)
120,190,150,0,255,120 Mosaic grassland (50-70%) / forest or shrubland (20-50%) 
130,150,100,0,255,130 Closed to open (>15%) (broadleaved or needleleaved evergreen or deciduous) shrubland (<5m)
140,255,180,50,255,140 Closed to open (>15%) herbaceous vegetation (grassland savannas or lichens/mosses)
150,255,235,175,255,150 Closed to open (>15%) herbaceous vegetation (grassland savannas or lichens/mosses)
160,0,120,90,255,160 Closed to open (>15%) broadleaved forest regularly flooded (semi-permanently or temporarily) - Fresh or brackish water
170,0,150,120,255,170 Closed (>40%) broadleaved forest or shrubland permanently flooded - Saline or brackish water
180,0,220,130,255,180 Closed to open (>15%) grassland or woody vegetation on regularly flooded or waterlogged soil -  Fresh brackish or saline water
190,195,20,0,255,190 Artificial surfaces and associated areas (Urban areas >50%)
200,255,245,215,255,200 Bare areas
210,0,70,200,255,210 Water bodies
220,255,255,255,255,220 Permanent snow and ice
230,0,0,0,255,230 No Data

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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