8

I am trying to style a new single-band raster with a platted style, but when I choose the ‘platted’ no colors or values appear, and I can’t find a way to add them.

QGIS Essen, Win 7.

enter image description here

7

I do not think QGIS currently supports the creation of palettes for rasters as this was mentioned in the book Mastering QGIS which was published in Mar 2015:

Paletted raster band rendering

The paletted raster band renderer applies a single color to a single raster value. QGIS supports the loading of rasters with paletted colors stored within and the changing the color assigned to the raster value. QGIS does not currently support the creation of color palettes for single band rendering. However, existing QGIS layer style files (.qml) that contain palettes can be applied by clicking on the Load Style button in the layer properties.

|improve this answer|||||
  • 3
    Note that QGIS styles are pretty straightforward XML. If you don't have another palette to start from, you can save a .qml file, open in a text editor, then replace the rasterrender tag with something like this: <rasterrenderer opacity="1" alphaBand="0" band="1" type="paletted"> <rasterTransparency/> <colorPalette> <paletteEntry value="0" color="#000000" label="0"/> </colorPalette> </rasterrenderer> – Nat Nov 15 '16 at 17:16
  • @Nat - You should consider posting your comment as an answer with an example ;) – Joseph Nov 16 '16 at 10:07
2

not sure where You want to go with that, but I would rather use Singleband pseudocolor option to adjust the rasters (data) options of visibility

|improve this answer|||||
2

If you don't have too many values to encode, here's an example file that you could import from the style menu at the bottom to get around the limitations mentioned in the other answers. You just have to save it as someFileName.qml.

<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis version="2.18.14">
<rasterrenderer opacity="1" alphaBand="0" band="1" type="paletted">
  <rasterTransparency/>
  <colorPalette>
    <paletteEntry value="0" color="#000000" label="0"/>
    <paletteEntry value="1" color="#ffffff" label="1"/>
  </colorPalette>
</rasterrenderer>
</qgis>

In this example, there is one paletteEntry for each value I'm trying to color - two in total. Can just add more below to meet your needs.

|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.