All Products
Search
Document Center

PolarDB:ST_ImportFrom

Last Updated:Mar 28, 2026

Creates a raster object and imports a file from Object Storage Service (OSS), MinIO, or Hadoop Distributed File System (HDFS) into it.

Syntax

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

Parameters

ParameterDescription
chunkTableNameThe name of the chunk table used to store the raster object. Must comply with PolarDB table naming conventions.
urlThe URL of the source file. For the supported URL formats, see the url parameter description in .
storageOptionA JSON string that specifies how the raster object is stored. Default: {}. See storageOption parameters.
importOptionA JSON string that configures the import behavior. Default: {}. See importOption parameters.

storageOption parameters

ParameterTypeDefaultDescription
chunkingbooleantrueSpecifies whether to store data as chunks.
chunkdimstringSame as the source dataThe chunk dimensions in w,h,b format. Takes effect only when chunking is true.
compressionstringlz4The compression format. Valid values: none, jpeg, zlib, png, lzo, lz4, snappy, zstd, jp2k.
qualityinteger75The image quality after compression. Valid only for the jpeg and jp2k compression formats.
interleavingstringSame as the source dataThe band interleaving method. Valid values: bip (Band Interleaved by Pixel), bil (Band Interleaved by Line), bsq (Band Sequential).
blockendianstringNDRThe byte order for each chunk. Valid values: NDR (little-endian), XDR (big-endian).
celltypestringSame as the source dataThe pixel type. Valid values: 1bb, 2bui, 4bui, 8bsi, 8bui, 16bsi, 16bui, 32bsi, 32bui, 32bf, 64bsi, 64bui, 64bf.

importOption parameters

ParameterTypeDefaultDescription
mapping_oss_filebooleanfalseSpecifies whether to map the source file into memory before reading. Enable this option when the driver generates many small read requests from OSS, which can degrade performance. To limit the maximum size of files that can be memory-mapped, set the GUC parameter .
parallelintegerValue of The degree of parallelism for the import. Valid values: 1 to 64.

Usage notes

To check which source file formats are supported, call .

Examples

-- Import a GeoTIFF file using only the required parameters.
SELECT ST_ImportFrom('chunk_table', 'OSS://<ak>:<ak_secret>@oss-cn-beijing-internal.aliyuncs.com/mybucket/data/image.tif');

-- Import a specific subset from a NetCDF file.
SELECT ST_ImportFrom('chunk_table', 'OSS://<ak>:<ak_secret>@oss-cn-beijing-internal.aliyuncs.com/mybucket/data/image.nc:hcc');

-- Import with custom chunk dimensions and no compression.
SELECT ST_ImportFrom('chunk_table', 'OSS://<ak>:<ak_secret>@oss-cn-beijing-internal.aliyuncs.com/mybucket/data/image.tif', '{"chunkdim":"(128,128,3)", "compression":"none"}');

-- Import with a degree of parallelism of 4.
SELECT ST_ImportFrom('chunk_table', 'OSS://<ak>:<ak_secret>@oss-cn-beijing-internal.aliyuncs.com/mybucket/data/image.nc:hcc', '{}', '{"parallel": 4}');