[Qgis-developer] raster algebra plugin II - the return!
b.rowlingson at lancaster.ac.uk
Sat Nov 29 14:46:06 EST 2008
2008/11/29 Martin Dobias <wonder.sk at gmail.com>:
> You would define some processing functions like:
> def rasterMax(r1, r2):
> return (... something ...)
There's hardly any need to do that - numpy.max(r1,r2) does exactly
that, and can take more than two parameters.
> Can you give me an example of more complex requirements?
In my original idea the plugin would have one line for entering an
expression, and some way of assigning raster layer bands to variables
in the expression (R1, R2 etc). The 'more complex requirements' would
be if you wanted to do more than one thing, or use an intermediate
calculation more than once. Like:
x1 = sin(R1)
x2 = x1 * x1
x3 = sqrt(x1)
> In fact
> allowing some raster algebra stuff into python could be done quite
> easily - a matter of adding some variables to globals dictionary, so
> users could run directly from console: RasterBand(...) *
Yeah, I'd add some helper functions to my plugin that you could just
import into the console (or any python code).
The RasterBand class could just be a superclass of numpy array that
also stores the raster band coordinates... One thing I'd do in the
plugin would be to make sure all rasters have the same grid system.
More information about the Qgis-developer