[postgis-devel] ST_MapAlgebraExpr(): Raster aggregates?

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Fri Nov 18 07:38:49 PST 2011


Tom,

Look at the plpgsql prototype of ST_Union(raster) in 

http://trac.osgeo.org/postgis/browser/trunk/raster/scripts/plpgsql/st_union.sql

Have a look also at the specifications of ST_UnionToRaster(geometry, val) in

http://trac.osgeo.org/postgis/wiki/WKTRaster/SpecificationWorking03

Everything is based on ST_MapAlgebraExpr(raster, raster, expr) and should do exactly what you want. 

It should be ok for producing low resolution raster as our first implementation of ST_MapAlgebraExpr(raster, raster) process pixel by pixel. Higher resolution will need an optimized version of ST_MapAlgebra(raster, raster) copying large areas of raster values when possible (it is exactly what we need for unioning two rasters efficiently). We started to make a plpgsql prototype for this optimized version but it is not finished (http://trac.osgeo.org/postgis/browser/trunk/raster/scripts/plpgsql/st_mapalgebra_optimized.sql). I guess we will need some funding to make it happen...

Let me know about your experiments...

Pierre


> -----Original Message-----
> From: postgis-devel-bounces at postgis.refractions.net [mailto:postgis-devel-
> bounces at postgis.refractions.net] On Behalf Of Tom van Tilburg
> Sent: Friday, November 18, 2011 6:25 AM
> To: postgis-devel at postgis.refractions.net
> Subject: [postgis-devel] ST_MapAlgebraExpr(): Raster aggregates?
> 
> Hi list,
> 
> At the moment I'm looking at the option of turning vector maps with discrete
> (non overlapping)  data into rasters with the help of the WKTraster functionality.
> At the moment I do as follows:
> 1. Collect (aggregate) al geoms from the same class 2. Make the into a raster
> with St_AsRaster() 3. Repeat for all classes 4. Merge all resulting rasters into 1
> with ST_MapAlgebraExp()
> 
> This step 4 I have to repeat (nest) a lot of times (for every class I have in my
> vector data). It would be great to have St_MapAlgebraExp() as an  aggregate
> function instead of just 2 rasters. This would greatly simplify the process of
> turning land use data from vectors/topology into raster. Is there any such thing
> available or in the make?
> 
> Regards,
>   Tom
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel



More information about the postgis-devel mailing list