[postgis-users] raster map algebra question(s)

Paragon Corporation lr at pcorp.us
Thu Dec 22 11:44:27 PST 2011


Steve,

Depends how your data is setup -- I'm assuming you are looking for a moving
average?

If for example you have a raster record for each date in the same table,
with a field denoting the date, then the best bet is probably use ST_Union
with the optional MEAN expression.

I haven't stress tested that yet.

So say you have a table

Rast, temp_date

Then you can do a 

SELECT ST_Union(rast, 'MEAN' )  OVER (ROWS  BETWEEN 1 PRECEDING AND CURRENT
ROW ORDER BY temp_date)  As newrast, temp_date
FROM temperatures;


Haven't tried using with window aggregates , but the above should work.
Also note the ROWS with number ranges was introduced in PostgreSQL 9.0 so
that particular syntax won't work with 8.4.

Hope that helps,
Regina

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Stephen
Crawford
Sent: Thursday, December 22, 2011 2:23 PM
To: PostGIS Users Discussion
Subject: [postgis-users] raster map algebra question(s)

Thanks to all who helped me on my previous raster output questions; I now
have a better handle on what I can (and can't) do.

How can I do map algebra across raster tables?  I have a db of raster tables
(all the same extend) with weather variables by date.  I have a number of
ways i want to use these data, but in the initial case I would like to, as
an example, create a new raster table where the data value at each cell is
the average of the previous day's values.  Any thoughts?

Thanks,
Steve

--
Stephen Crawford
Center for Environmental Informatics
The Pennsylvania State University



_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users





More information about the postgis-users mailing list