I would like to perform raster calculations in PostGIS. (A change detection should be performed, for this purpose every pixel of different raster is accessed and it is checked if the pixel values have changed over the time period).
Which PostGIS function should be used best for this? I thought
ST_MapAlgebra would be the best choice, but in this post it was written that
ST_Union is better suited for this purpose, even if simple calculations are to be performed.
So what function should be used and how would you implement the change detection. (The Analysis will be similar to this GDAL Calculation, where A,B,C,D,E are five different bands.
(logical_and(A-B, B-A) != 0) * 1 + (logical_and(B-C, C-B) != 0) * 1 + (logical_and(C-D,D-C) != 0 )* 1 + (logical_and(D-E,E-D) != 0) * 1
Edit: Furthermore can you do calculations with ST_MapAlgebra with more than two bands?