I am trying to calculate the average of multiple rasters stored as raster
datatype in PostGIS enabled database. The rasters are stored in three different tables (spi3, sri3, and smdi) and have date
as common column. I am trying to use ST_Union function of PostGIS, where it says we can specify setof
raster.
This is what I have done so far.
select st_union(SETOF[spi3_raster, sri3_raster, smdi_raster], 'MEAN')
from
(
select spi3.raster as spi3_raster, sri3.raster as sri3_raster, smdi.raster as smdi_raster
from spi3 as spi3
join sri3 as sri3
on spi3.date = sri3.date
and sri3.date = '2013-01-01'
join smdi as smdi
on sri3.date = smdi.date
where spi3.date = '2013-01-01'
) as foo;
However, I am not getting the result as expected.
ERROR: syntax error at or near "," LINE 1: select st_union(SETOF[spi3_raster, sri3_raster, smdi_raster]... ^ ********** Error ********** ERROR: syntax error at or near "," SQL state: 42601 Character: 34
.