I want to extract raster values which is greater than 0.5 .I Used Raster Calculator to create a new raster which have values greater than 0.5 .

Formula for Raster Calculator:

("raster" > 0.5) * "raster"

but it create a tiff having values from 0 . Now I want to change 0 to No Data

For this i tried Raster--> Conversion --> Translate(Convert Format)

gdal_translate -a_nodata 0 -of GTiff input.tif output.tif

But output does'nt have correct values.

Is there any other way to do this by Python Console or by GDAL .


You could use the following in the Raster Calculator to get all values greater than 0.5 and anything else be shown as nodata:

"raster" / ("raster" > 0.5)
  • 1
    Thanx @Joseph it works :) – User18 Dec 8 '16 at 11:24
  • @User18 - Most welcome, glad it worked ;) – Joseph Dec 8 '16 at 11:25
  • @User18 - The nodata cells still count as cells, they haven't been removed. So the count number should be the same. Is this what you were asking? – Joseph Dec 8 '16 at 11:35
  • It is resolved now.. actually i selected wrong input . hope u dont mind :) – User18 Dec 8 '16 at 11:35
  • @User18 - No problem at all, glad you got it resolved :) – Joseph Dec 8 '16 at 11:37

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.