Merges one or more source raster objects into a target raster object.
Syntax
raster ST_MosaicTo(raster raster_obj, raster source[]);Parameters
| Parameter | Description |
|---|---|
raster_obj | The target raster object to merge into. |
source | One or more source raster objects to merge into raster_obj. |
Usage notes
Before calling ST_MosaicTo, make sure the source and target raster objects meet all of the following requirements.
Same number of bands: All raster objects must have the same number of bands.
Consistent georeferencing: All raster objects must be georeferenced, or none of them can be georeferenced. If all are georeferenced, world coordinates (geographic coordinates) are used for the mosaic operation.
Same spatial reference: If world coordinates are used, all raster objects must share the same spatial reference system identifier (SRID) and affine parameters. Pixel types may differ.
Configure NoData behavior
Set ganos.raster.mosaic_must_same_nodata to control how the mosaic operation handles NoData values across source raster objects. NoData values are not changed during the mosaic operation.
| Value | Behavior |
|---|---|
true | All source raster objects must have the same NoData value. |
false | Source raster objects may have different NoData values. Pixel semantics may change after the mosaic operation. |
To set this parameter, run:
Set ganos.raster.mosaic_must_same_nodata = false;Example
The following example merges all raster objects with id < 10 into the raster object where id = 11.
Update raster_table Set raster_obj = ST_MosaicTo(raster_obj, Array(select raster_obj from raster_table where id < 10)) where id = 11;