I have a multi-band raster in the form of a GeoTIFF. The raster contains 4 bands. Band 2 has 27 unique values ranging from 151 - 281. I would like to display each value discreetly using the 'Paletted/Unique values' option in Band rendering. When I click 'classify' the correct values are displayed but when I apply and close the dialogue nothing is displayed in QGIS.

enter image description here

If I use 'Singleband Pseudocolor' it displays fine but I'd like to display discrete colours without having to go through each value and change the colour. What's going on here? Why is Paletted/Unique not working?

enter image description here enter image description here

  • what happens if you remove the Hue->Colorize flag? Is that raster the only layer in your project or are there overlying ones which could interfere? – RafDouglas May 20 '19 at 13:03
  • @RafDouglas Removing the Hue->Colorize flag doesn't change anything. The raster is the only layer in the project. I should probably also mention that the 27 labels display correctly in the 'Layers' window after applying the rendering. – Adam G May 20 '19 at 13:43
  • Would you mind posting a screenshot of the 'Singleband Pseudocolor ? I can't think of a reason for the "no-show" :) – RafDouglas May 20 '19 at 14:03
  • 1
    @RafDouglas I edited my post to include the screenshot. I realised that this method doesn't display the correct discrete values as it just evenly spreads the values between the min and max. – Adam G May 20 '19 at 14:35
  • 1
    Hmm interesting, didn't work on that file. But if i add classification values from 0 (0,1,2,..etc), it shows some data on map. It has to do with values lookup, data type or something... strange. I can solve this by rearranging bands to new raster (rearrange band processing tool). There I chose band 2 only, output data type set to int16 and run. On that output, I was able to classify that raster as expected. Hope that helps. – DavidP May 22 '19 at 10:14

I think that if your raster displays correctly when color-mapped using a continuum spectrum (Linear interpolation) and not when using discrete values is because the values of the pixels are not comprised in the list of Paletted/Unique Value classified colors.

If you set:

151 -> pink
156 -> light brown

A pixel whose value is, for example, 151.01 or 153 (non of which are present in the Paletted/Unique Value list) does not have a color associated and will therefore not be represented at all.

If, instead, you choose Singleband pseudocolor, you can still assign the same ramp/list as above, but in this case intermediate values will be interpolated. A pixel with a value of 151.01 will look pink, one valued 153 will have a color midway between ping and light-brown. And most importantly, both will be represented.

  • That can't be the case as there are no values between those identified by rendering the band with unique values. The values in the band are days of year. There are no decimel values or values inbetween. I know the 27 values and selecting Paletted/Unique values renders the correct 27 values. – Adam G May 20 '19 at 15:29
  • If using Paletted/Unique values renders correctly, then I don't understand the original question... – RafDouglas May 20 '19 at 15:36
  • By "renders correctly" I mean that by clicking Paletted/Unique values > Classify the correct band values (i.e. the 27 DOY) appear in the symbology window and in the layers window. However, as per my original question, the polygons do not display in QGIS. It's as if QGIS knows what I want it do and does everything it's supposed to do up until displaying the polygons. I edited my original post to include a screenshot of the empty display with the correctly labelled layers window. – Adam G May 21 '19 at 8:53
  • I see, thanks. If you revert to the B/W or Singleband pseudocolor, then sample the raster with the Identify Features tool (the arrow with the "info" icon) on Band 2 do you see the same values as the one in the classification? or slightly different ones? – RafDouglas May 21 '19 at 10:06
  • 1
    I installed 3.6.3-Noosa and it works fine, the unique values are displaying as they should. It seems to me like this was an issue related to version 3.4.4 but I'd be interested to hear which version @DavidP is using. – Adam G May 23 '19 at 11:57

I got around the problem by installing the newest version of QGIS 3.6.3-Noosa. Whilst the problem itself had occurred in 3.4.4 and was replicated by @DavidP in 3.6.0, it did not occur in 3.6.2 or 3.6.3. This does not necesarily mean that the problem is specifically related to the version of QGIS but for me this solved the problem.

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.