[postgis-devel] WKTRaster ST_MapAlgebra

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Tue Feb 9 13:29:42 PST 2010


This is a good question...

I guess users would expect the same kind of result as in any GIS package: The pixel values used to compute the mathematical expression SHOULD spatially overlap.

For operations like this in general, PostGIS assume that involved layers are in the same coordinate system. There is no such things as automatic on the fly layer reprojection. I don't remember if it warn you if it you attempt an operation on two layers projected in two different CS.

Now what to do when the rasters ovelaps but the pixel sizes are different? Or when they have different rotations? What does GRASS does? What does ArcGIS does? Whar R does? I would definitely play with those before designing anything. We should design the rules involved in this kind of function so we can reuse them when we are confronted to similar alignment problem in other functions (Intersection(raster, raster)->raster, ST_Difference(raster A, raster B)->raster, i.e. most functions taking two or more overlapping rasters and returning one raster).

You also always have to decide what will be the CS, alignment and pixel size of the resulting raster. You can impose the ones of one of the raster involved (the "master raster") with an integer parameter specifying the index of the "master raster". You could also supply variant of the function allowing to specify these params. Do we want to realign/resample slave rasters before doing te operation. This does not seems very efficient but maybe there is no other real avenue.

For sure the challenge is huge. I would maybe start by implementing supports for operations on a single raster, delaying problems of alignment for later.

Pierre

From: postgis-devel-bounces at postgis.refractions.net [mailto:postgis-devel-bounces at postgis.refractions.net] On Behalf Of David Zwarg
Sent: 9 février 2010 15:54
To: PostGIS Development Discussion
Subject: [postgis-devel] WKTRaster ST_MapAlgebra

Greetings,

I was reviewing the working spec (http://trac.osgeo.org/postgis/wiki/WKTRaster/SpecificationWorking03), and thinking about ST_MapAlgebra:

ST_MapAlgebra(raster|geometry, [raster|geometry,...], 'mathematical expression', 'raster' |'geometry') -> raster/geometry

I am considering the following question in the context of using ST_MapAlgebra with rasters, and returning a raster. Should this function only perform operations on similar rasters?  Meaning: do the georeferencing, spatial reference, and pixel size have to be the same in all input rasters?

Thanks,
Zwarg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20100209/1022c529/attachment.html>


More information about the postgis-devel mailing list