5

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?

10

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)"
5

@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 :)

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.