I have a 32-bit GeoTIFF that represents floating point elevation values, and I'd like to change the sign so that the values are negative instead of positive.
What is the easiest way to do this using open source tools?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
I don't know if this is the easiest way, but one way would be to use
gdal_calc.py from GDAL:
gdal_calc.py -A positive_values.tif --outfile=negative_values.tif --calc="A*(-1.0)"
@Rich Signell provides an excellent solution (+1). I only add this answer as an alternative depending on what you are familiar with. In QGIS you could use the Raster calculator and do this via the GUI:
"myDTM@1" * -1
This is effectively the same thing as Rich's solution given that QGIS uses GDAL under the hood, but you might prefer to use a GUI instead of the command line. Through QGIS you can also use the GUI dialogs for the GRASS and SAGA raster calculators and do pretty much the same thing - so you have three solutions for the price of one here :)