[postgis-users] Merge rasters with multiple bands

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Mon Aug 15 09:15:41 PDT 2016


ST_Union works on overlapping rasters as well but maybe you have to provide two 3 bands rasters. If your rasters are tiled, you also have to GROUP BY tiles having the same alignment:

GROUP BY ST_UpperleftX(rast), ST_UpperleftY(rast)

ST_MapAlgebra() should work also. The expression should be equal to the raster with values and the extenttype to the 256x256 pixel one. They shoulp overlap.

Pierre


> -----Original Message-----
> From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf
> Of Alexander Rumanovsk
> Sent: Wednesday, August 10, 2016 12:40 PM
> To: postgis-users at lists.osgeo.org
> Subject: [postgis-users] Merge rasters with multiple bands
> 
> Hello all,
> 
> I'm trying to merge a raster with 3 bands to an empty raster. The empty raster is
> created with the query bellow:
> 
> ST_AddBand(ST_MakeEmptyRaster(256,256,0,0,1), '8BUI'::text,200)
> 
> 
> This empty raster is larger than the filled one (which is 100x100). I just need to
> create a raster of 256x256 with the original raster (100x100) information and
> the rest filled with empty information.
> My first idea was to use ST_Union, but found out it just merges tiles, instead of
> rasters.
> Anyone have an idea how can I do that?
> 
> thanks in advance
> Rumanovsk


More information about the postgis-users mailing list