[postgis-devel] Raster todo list

dustymugs dustymugs at gmail.com
Thu Jun 16 16:45:15 PDT 2011


>> How would you build a very generic MapAlgebra requiring raster expressions
>> like 'rast1 * rast2 + 120' from something like ST_Intersection?
>>
>>
> Well since you asked, here's how I would approach the problem:
>
> Make ST_Intersection(raster,raster) return a mask (e.g., a one-band raster
> having only true/false values). The mask represents the common area.
> MapAlgebra uses this mask to determine the size and properties of the
> resultant raster (corner location, # pixels in x and y direction, size of
> pixels, etc.). MapAlgebra adds the ability to compute a value using a
> user-specified arbitrary expression, but only does so over the grid cells
> having a "true" value in the mask.
>

This basically is how I've been envisioning the output of an underlying 
intersection function.  The mask can then be passed along to functions 
like ST_Clip or ST_SummaryStats to generate an output raster or a 
focused set of stats.

Granted, work still needs to be done for functions that rectify the set 
of rasters so that all the rasters have the same projection, same pixel 
size, same skew and if the rasters overlap, the overlap is at pixel 
boundaries.

>   Using this philosophy, there is a clear and logical separation between the
> spatial operation (ST_{Difference,SymDifference,Union,Intersection}) and the
> value computation part (MapAlgebra). More modular, easier to understand,
> easier to re-use, easier to maintain.
>

Seems like a reasonable idea.  I'll read your linked page when I get the 
chance.

-bborie



More information about the postgis-devel mailing list