[postgis-users] Raster calculation on 3d raster (stack)

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Fri Nov 20 05:23:43 PST 2015


Doesn’t the second example (One raster, several bands) similar to your case in the doc?

http://postgis.net/docs/RT_ST_MapAlgebra.html

Pierre

From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of David Haynes
Sent: Tuesday, November 17, 2015 9:48 AM
To: postgis-users at lists.osgeo.org
Subject: [postgis-users] Raster calculation on 3d raster (stack)

Hello,

I have a mulibanded raster and I am wondering if I can apply any of the raster processing functions (min, max, mean, stdev) to multibanded rasters. Specifically, I am wondering if these functions will be able to applied to the z-axis.

Here is an example, I have worked up in python starting with two 2d arrays.
x = [[1,4,5,6], [3,5,6,2]]
z = [[2,7,8,9], [8,3,5,9]]
convert to np.array
y = np.dstack((np.array(x), np.array(z)))
>>> y.sum(2)
array([[ 3, 11, 13, 15],
       [11,  8, 11, 11]])

I want to apply the raster processing functions to the z-axis and I am wondering if I can do it in PostGIS? It seems like the mapalgebra call back functions could do this, but I am having difficulty finding an example.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20151120/61ba12e4/attachment.html>


More information about the postgis-users mailing list