This topic describes the ST_CreateRast function. This function creates a raster object by using the data stored in an Alibaba Cloud Object Storage Service (OSS) bucket or a self-managed Multi-Cloud Object Storage (MinIO) bucket.


raster ST_CreateRast(cstring url);
raster ST_CreateRast(cstring url, cstring storageOption);


Parameter Description
url The path of the object based on which you want to create a raster object.
storageOption A JSON string that describes the chunks for storing the pyramid of the raster object.

The following table describes the fields of the storageOption parameter.

Field Description Type Format Default value Description
chunkdim The size of each chunk that is used to store the data of the raster object. String (w, h, b) Same as the size of each chunk in the original object N/A
interleaving The interleaving type of the raster object. String N/A bsq Valid values:
  • bip: band interleaved by pixel (BIP)
  • bil: band interleaved by line (BIL)
  • bsq: band sequential (BSQ)
  • auto: an interleaving method that is specified by this function
Note You need to change the default values of the chunkdim and interleaving fields only in some cases:
  • Users want to view the raster object based on multiband red, green, and blue (RGB) combination, but the value of the interleaving field is bsq. In this case, you must change the value of the interleaving field to bip.
  • The chunks of some images that are used to render the raster object contain 1 row and n columns in size. However, users request chunks that contain 256 rows and 256 columns in size. In this case, you must change the value of the chunkdim field to the requested chunk size.


You can obtain the supported data types by using the ST_RasterDrivers function.


-- Specify the AccessKey ID, AccessKey secret, and endpoint in the URL of an OSS object to create a raster object.
Select ST_CreateRast('OSS://<ak>:<ak_secret>');

-- Specify the host and port number in the URL of a MinIO bucket to create a raster object.
Select ST_CreateRast('OSS://<ak>:<ak_secret>@');

-- Specify the chunk size and the interleaving type of a raster object.
Select ST_CreateRast('OSS://<ak>:<ak_secret>', '{"chunkdim":"(256,256,3)","interleaving":"auto"}');

-- Specify a NetCDF image that contains subsets.
Select ST_CreateRast('OSS://<ak>:<ak_secret>');