2

I am just getting into rasters in PostGIS and I have stumbled across a problem I can't solve:
Given one large raster A (e.g. pixel size 5km x 5km) and one smaller raster B (e.g. 1km x 1km) which might not be aligned in any way - how do I create a new raster with pixels from raster A (size, position) having the mean of the values of all Pixels in B intersecting the pixel in A as values.
I have come across ST_Union which looks similar but doesn't quite seem to do the job and I don't yet understand ST_MapAlgebra enough to see if it's useful here.

Can anyone help me out with this one?

1

Have a look at ST_GlobalRasterUnion() in the PostGIS Addons. You can do:

SELECT ST_GlobalRasterUnion('public', 'raster_table_B', 'rast', 'AREA_WEIGHTED_MEAN_OF_RASTER_VALUES') rast;

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.