I'd like to be able to alter raster values, through fairly simple equations, without using the module ArcPy.

Is that possible?

It seems like gdal, numpy, and rasterlang might make this possible but I'm having trouble figuring out exactly how.


Yes, but you must know Python (and not just ArcPy):

You can use osgeo/gdal, rasterio, Python raster stats or pyresample, for example, in combination with others scientific Python modules as Numpy, SciPy, and ...

There are lots of examples on the Web but to begin, look at

| improve this answer | |

It depends on the type of operations you'd like to carry out and the languages you already know... Python-gdal or R (with the raster library) are good open source solutions.

Since it seems you're more into Python, here is a good place to start -- especially lessons 4-6.

Here is a small example of applying a threshold to a raster:

import os, sys, numpy, gdal
from gdalconst import *


# register all of the GDAL drivers

# open the image 
inDs = gdal.Open('my_raster.img', GA_ReadOnly)
if inDs is None:
  print 'Could not open my_raster.img'

# get image size
rows = inDs.RasterYSize
cols = inDs.RasterXSize

# read the input data
inBand = inDs.GetRasterBand(1)
inData = inBand.ReadAsArray(0, 0, cols, rows).astype(numpy.Float)

#simple raster algebra
outData = numpy.where(inData >= 5, 10, 0)

# create the output image
driver = inDs.GetDriver()
outDs = driver.Create('highpass1.img', cols, rows, 1, GDT_Float32)
if outDs is None:
  print 'Could not create highpass1.img'
outBand = outDs.GetRasterBand(1)

# write the output data
outBand.WriteArray(outData, 0, 0)

# flush data to disk, set the NoData value and calculate stats
stats = outBand.GetStatistics(0, 1)

# georeference the image and set the projection

inDs = None
outDs = None
| improve this answer | |

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