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.


1 Answer 1


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"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.