This topic describes the S​T_MosaicFrom function, which performs a mosaic operation to combine multiple raster objects into a new raster object.

Syntax

raster ST_MosaicFrom(raster source[],  cstring chunkTableName);

Parameters

Parameter Description
source The name of the raster objects that you want to combine.
chunkTableName The name of the chunk table for storing the new raster object. The name must comply with the table naming conventions of ApsaraDB RDS for PostgreSQL.

Description

This function combines multiple raster objects into a new one.

All of the raster objects that you want to combine must meet the following requirements:
  • They have the same number of bands.
  • They are all geographically referenced, or none of them is geographically referenced. If all of them are geographically referenced, world coordinates (geographic coordinates) are used for the mosaic operation.
  • Although they can have different pixel types, they must have the same spatial reference system identifier (SRID) and affine parameters if world coordinates are used for the mosaic operation.

You must configure the following parameter.

Parameter Type Description
ganos.raster.mosaic_must_same_nodata boolean Specifies whether the values of NoData in a data source must be the same during the mosaic operation. Valid values: true and false. The values of NoData are not changed during the mosaic operation. If you set this parameter to false, the semantics of the pixels after the mosaic operation may be changed. Example:
Set ganos.raster.mosaic_must_same_nodata = false;

Example

Insert Into raster_obj Values(1, ST_MosaicFrom(Array(select raster_obj from raster_table where id < 10), 'chunk_table_mosaic'))
Update raster_table Set raster_obj = ST_MosaicFrom(Array(select raster_obj from raster_table where id < 10), 'chunk_table_mosaic') where id = 11;