3

I have a raster with the following pixel values:

  • 1100: corresponds to grassland
  • 1104 to 1134: corresponds to a forest plantation and values from 4 to 34 are the age of the plantation
  • 1204 to 1234: corresponds to another type of forest plantation and the values from 4 to 34 are the age of the plantation
  • 1304 to 1334: corresponds to another type of forest plantation and the values from 4 to 34 are the age of the plantation
  • And many more values of this type.

How can I assign colors with the symbology to this raster like this?

  • 1100: yellow
  • 1104 to 1134: shades of green from low to high intensity
  • 1204 to 1234: shades of orange from low to high intensity
  • 1304 to 1334: shades of red from low to high intensity

It is not an option to transform the raster into a vector because it corresponds to a very large area.

3
  • You can prepare a RGBA color palette file (.clr) and use it in the Paletted symbology. But do you really need 31 shades (each for values from 04 to 34)?
    – Kazuhito
    Feb 25, 2021 at 10:10
  • Thank you very much for the reply. No, I don't need 30 different values (34 - 4), only 6 that correspond to age classes, for example 4 to 6 is the first class and so on. The difficulty is that I have many pixel values (1100, 1104 to 1134; 1204 to 1234; 1304 to 1334; 2104 to 2134; 2204 to 2234 and 2304 to 2334). Anyway, I don't know how to create an RGBA palette, can you tell me how to do it?
    – mSandoval
    Feb 25, 2021 at 11:50
  • Some color shades are available online, and I recommend ColorBrewer if you need up to 9 shades. For more classes, there is Color gradients explorer. Let me post an answer just to explain about the clr file.
    – Kazuhito
    Feb 25, 2021 at 12:08

1 Answer 1

1

On the RHS of the Raster symbology window, there is a small ellipsis (three dots) button which can export/import Color Map file (.clr).

enter image description here

This clr is just a text file, you can open it with any text editors. (Below is an example which represents the color palette used in the above.)

0 100 156 239 255 0
1 222 141 19 255 1
2 133 225 110 255 2
3 68 206 123 255 3
4 220 15 15 255 4
5 95 69 202 255 5
6 201 60 145 255 6
7 207 239 77 255 7
8 63 234 234 255 8
9 195 51 230 255 9

The 5 columns are; value, R, G, B, A, and label.

If you need 6 shades of Blue, visit ColorBrewer site, find the single hue of blue, and check the corresponding RGB value. (You may prefer to download the Excel file)

enter image description here

So the Yellow and Green part is:

1100 255 255   0 255 1100
1104   0 109  44 255 1104
1110  49 163  84 255 1110
1116 116 196 118 255 1116
1122 161 217 155 255 1122
1128 199 233 192 255 1128
1134 237 248 233 255 1134

Keep adding rows for oranges and reds, then save the text file with (.clr) extension. Use Load Color Map from File to import the clr file.

2
  • Wow, I've been using Colorbrewer for a long time and never noticed the "Download" button. Now I'll never have to laboriously type the RGB values manually. Presto!
    – Stu Smith
    Feb 25, 2021 at 17:05
  • Thank you very much, your answer has been very useful. I am going to try this method but I understand the general concept.
    – mSandoval
    Feb 25, 2021 at 17:18

Your Answer

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

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