I have raster data stored in a PostgreSQL/PostGIS database. I need to create a summed raster from certain rasters.
select sum(raw_data) as image from data where rid > 2 AND rid < 5;
But this is not the correct function. What is?
Use ST_Union(rast, 'SUM')
Overlapping pixels will be summed into a new raster. Note there are also FIRST, MIN, MAX, COUNT, MEAN, RANGE options for the uniontype paramter.