2

I have a raster with some no-data cells.

I want to visualise raster values using a colour map and set the no data values to transparent. I am attempting to do this using the transparency tab in the layer properties dialogue.

This all went well when I am viewing a small section of the raster:

enter image description here

However, when I zoom out the no data pixels become visible and the identify tool says the value is now -inf.

enter image description here

There seems to be a trigger point at which this happens, for all larger scales the no data values are left transparent and for all smaller scales I get this strange -inf thing.

Why does this happen and how can I stop it?

This is only the 3rd time I have used QGIS so apologies if this is a well known thing that is easily solvable - I couldn't seem to find a similar question.

Due to workplace limitations I am forced to use QGIS 2.2.0-Valmiera.

The raster is a .tif

2

Can't seem to replicate your issue. I tested it with a 1:50m global raster and the no data values seem to stay transparent throughout the varying scales. Perhaps you can try another method which is to convert your no data values to an integer (i.e. 0). You can do this by:

  1. Reprojecting your raster and setting the No data values parameter to blank:

    Example raster

    Warp

  2. The no data values should show as 0:

    Warped raster

  3. Then go to Layer Properties > Transparency > No data value and enter 0. Hopefully when you scale, the transparency will remain.

Result

  • 1
    Thanks for the response - I am still getting the same issues after implementing your solution but I don't get the same error with other raster data I tested. The raster is derived from vector data so I am going to go back to the beginning and start again to see if I can resolve. – ASeaton Apr 7 '16 at 10:14
  • @ASeaton - Most welcome, hope you can resolve the issue :) – Joseph Apr 8 '16 at 9:01

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.