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.
-
There is a nice example of accessing rasters through the GDAL GeoTIFF driver here (see the answer that was awarded bounty): gis.stackexchange.com/questions/72183/…Conor– Conor2014年01月28日 17:43:05 +00:00Commented Jan 28, 2014 at 17:43
-
1You can also access the QgsRasterCalculator Class using Python. More details here: gis.stackexchange.com/a/59305/8104.Aaron– Aaron ♦2014年01月28日 18:43:20 +00:00Commented Jan 28, 2014 at 18:43
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"
Explore related questions
See similar questions with these tags.