6

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.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jan 28, 2014 at 17:36
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/… Commented Jan 28, 2014 at 17:43
  • 1
    You can also access the QgsRasterCalculator Class using Python. More details here: gis.stackexchange.com/a/59305/8104. Commented Jan 28, 2014 at 18:43

1 Answer 1

11

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"
answered Jan 28, 2014 at 17:58
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.