[Qgis-developer] raster algebra plugin II - the return!

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Fri Nov 28 19:28:13 EST 2008


2008/11/28 Kolberg Sjur A <Sjur.A.Kolberg at sintef.no>:
>
>
> If you're taking votes...
>
> My suggestion would be a multi-line edit window for the expression, where raster bands could be written as variable names.

Something like:

 r1 = 120 - raster(layer=0,band=1)
 r2 = 200 - raster(layer=1,band=1)
 r3 = r1 + r2
 saveAndLoadLayer(r1,"r1.tiff")
 saveAndLoadLayer(r2,"r2.tiff")
 save(r3,"r3.tiff")

 hang on, that's starting to look familiar...

 If it gets this complex, you might just as well use Python from the
console and import your scripts... That's all my plugin will be doing
anyway, loading rasters into python objects via gdal, processing them
with numpy functions, and saving them to new Gtiffs...

 Of course there is an advantage to keeping it simple and restricting
the syntax. Plus it makes it easier to write a graphical interface
much like the grass raster algebra tool.

Barry


More information about the Qgis-developer mailing list