TransWikia.com

Is it possible to do raster calculations with ST_Union (PostGIS)?

Geographic Information Systems Asked by soph on October 6, 2020

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?

One Answer

When more complicated calculations are performed as returning the average or maximum value of multiple grids, ST_MapAlgebra should be used and not ST_Union.

A tutorial which shows a better example than the official documentation of of ST_MapAlgebra at the PostGIS page can be found here. It also explains how to initialize the callback function which is needed when working with more than two grids.

Answered by soph on October 6, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP