Folks,

I played around a bit with the map algebra idea and came up with something that could work nicely as a plugin. The initial code is at https://github.com/ajolma/gdal/tree/trunk/gdal/map_algebra

The idea is based on processing raster bands block by block and calling a given function on each block. Using macros and templates the code should be rather nice and manageable even when supporting multiple data types for raster cells.

Further, the idea is to support three kinds of map algebra methods, mostly working on a raster band in-place.

1) Simple ones, which do not take any arguments beyond the raster band itself, examples are functions like log, sin, rand.

2) Those which take one non-spatial argument. The argument can be a scalar like a number, or more complex like a reclassifier.

3) Those which operate on two rasters. Examples are summation of rasters and computing flow directions on a DEM. The latter is a bit more complex since it is a focal method and requires a 3 x 3 matrix of blocks from the other operand raster.

Maybe a fourth kind of methods are those which compute something from a raster.

This would lead to four functions in the C API and raster band methods in the bindings.

Comments are welcome, the initial code base contains a small demo program. Eventually, if this works, I'll make a RFC from this.

Ari

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to