4

I have a geotiff that I converted to a ENVI raster file with the following command:

gdal_translate -of ENVI srtm_05_08.tif data.bil

The geotiff has water values supposedly set to nodata. I am doing an interpolation on the data.bil file, and when I do, the water shows up at a height of about 32000m. I am wondering if there is a simple way to change the nodata to be 0. I tried:

gdal_translate -of ENVI srtm_05_08.tif data.bil -a_nodata none

and

gdal_translate -of ENVI srtm_05_08.tif data.bil -a_nodata 0.0

but neither of those seemed to work.

Is there an easy way to switch the data values? I could do something like: if (val>5000) then val=0 but I am very much a beginner and don't know how to do it.

2

NODATA is a tag, not a value.

If you only need to attach NODATA to a different value you can try:

gdal_edit -a_nodata NEWVALUE input.tif

You strip away NODATA tag (always helpful) with:

gdal_translate -a_nodata none

Finally, if you need to actualy change the value and reattach NODATA to it, you might try something like this:

gdal_calc -A input.tif --outfile=output.tif --calc="255*(A==0)" --NoDataValue=255

You can modify --calc part to suit your needs, it supports many things.

0

Have a look at this thread. If you have access to ArcMap you could you the SetNull tool in Spatial Analyst as discussed here.

  • It would be helpful to include a summary of the first link in case the link goes away. – Aaron Jul 1 '15 at 13:38

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.