This topic describes the ST_ImportFrom function, which is used to import an Object Storage Service (OSS) object into a raster object in PolarDB.


raster ST_ImportFrom(cstring chunkTableName, 
                     cstring url, 
                     cstring storageOption default '{}',
                     cstring importOption default '{}');


Parameter Description
chunkTableName The name of the OSS object. The OSS object is a chunk table. The name must comply with the table naming conventions of PolarDB.
url The path of the OSS object. For more information, see the description of the url parameter in ST_CreateRast.
storageOption The JSON string that is used to specify the storage information of the raster object.
importOption The JSON string that is used to specify the import-related parameters. PolarDB supports the parallel parameter. This parameter specifies the degree of parallelism. The data type of this parameter is INTEGER. The value of this parameter ranges from 1 to 64. If you do not specify the parallel parameter, the value of the GUC parameter is used as the default degree of parallelism. For more information, see

The following table describes the parameters in storageOption.

Parameter Type Default value Description
chunking boolean true Specifies whether to store the data as chunks.
chunkdim string Same as the value for the original data The dimensions that are used to chunk data. Format: w, h, b.
Note This parameter takes effect only when you set the chunking parameter to true.
compression string lz4 The format that is used to compress the data of the OSS object. Valid values:
  • none
  • jpeg
  • zlib
  • png
  • lzo
  • lz4
  • snappy
  • zstd
  • jp2k
quality integer 75 The quality of compression. This parameter is valid only for the JPEG and JPEG 2000 compression formats.
interleaving string Same as the value for the original data The method that is used to interleave the data of the OSS object. Valid values:
  • bip : Band interleaved by pixel
  • bil : Band nterleaved by pixel
  • bsq : Band Sequential
blockendian string 'NDR' The sequence that is used to store the bytes in each data chunk. Valid values:
  • NDR: little endian
  • XDR: big endian
celltype string Same as the value for the original data The pixel type of the raster object. Valid values:
  • 1bb: 1 bit
  • 2bui: 2-bit unsigned integer
  • 4bui: 4-bit unsigned integer
  • 8bs: 8-bit signed integer
  • 8bui: 8-bit unsigned integer
  • 16bsi: 16-bit signed integer
  • 16bui: 16-bit unsigned integer
  • 32bsi: 32-bit signed integer
  • 32bui: 32-bit unsigned integer
  • 32bf: 32-bit float
  • 64bsi: 64-bit signed integer
  • 64bui: 64-bit unsigned integer
  • 64bf: 64-bit float


This function is used to create a raster object and import an OSS object into the created raster object.

The following table lists the data types that are supported by this function.

Data type Full name
BMP Microsoft Windows Device Independent Bitmap(.bmp)
EHdr ESRI .hdr Labelled
ENVI ENVI .hdr Labelled Raster
GTiff TIFF/BigTIFF/GeoTIFF(.tif)
HFA Erdas Imagine .img
RST Idrisi Raster Format
INGR Intergraph Raster Format
netCDF Network Common Data Form
AAIGrid Arc/Info ASCII Grid
AIG Arc/Info Binary Grid
GIF Graphics Interchange Format
PNG Portable Network Graphics


-- Specify only the name and path of the OSS object that you want to import.
Select ST_ImportFrom('chunk_table','OSS://<ak>:<ak_secret>');

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

-- Specify the size per chunk and the compression format during the import process.
Select ST_ImportFrom('chunk_table','OSS://<ak>:<ak_secret>', '{"chunkdim":"(128,128,3)", "compression":"none"}');

-- Specify the degree of parallelism at import.
Select ST_ImportFrom('chunk_table','OSS://<ak>:<ak_secret>', '{}', '{"parallel": 4}');