I have raster data stored in a PostgreSQL/PostGIS database. I need to create a summed raster from certain rasters.

Something like:

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.

  • Good to know. There was me thinking you needed MapAlgebra, hugely overcomplicating things as always. Mar 9 '16 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.