[GIS] Performing Raster Calculator functions using Python and open source modules

open-source-gispyqgispythonraster-calculator

I would like to perform mathematical functions similar to those you would use Raster Calculator for in ArcMap, however I'd like to do it in Python without using the ArcpPy module. I have the osgeo module, and it seems like it should be possible to do however I'm having a hard time finding any useful syntax.

An example function would be to multiply every cell value in an input raster by 2.

Best Answer

Without reinventing the wheel, I suggest you to use gdal_calc.py. Example:

gdal_calc.py -A input.tif --outfile=result.tif --calc="A*2"
Related Question