This topic describes the ST_ImportFrom function, which is used to import an Object Storage Service (OSS) object into a raster object in PolarDB.
Syntax
raster ST_ImportFrom(cstring chunkTableName,
cstring url,
cstring storageOption default '{}',
cstring importOption default '{}');
Parameters
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 ganos.parallel.degree is used as the default degree of parallelism. For more information, see ganos.parallel.degree. |
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:
|
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:
|
blockendian | string | 'NDR' | The sequence that is used to store the bytes in each data chunk. Valid values:
|
celltype | string | Same as the value for the original data | The pixel type of the raster object. Valid values:
|
Description
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 |
JPEG | JPEG JFIF File Format |
Examples
-- Specify only the name and path of the OSS object that you want to import.
Select ST_ImportFrom('chunk_table','OSS://<ak>:<ak_secret>@oss-cn-beijing-internal.aliyuncs.com/mybucket/data/image.tif');
-- Specify a NetCDF image that contains subsets.
Select ST_ImportFrom('chunk_table','OSS://<ak>:<ak_secret>@oss-cn-beijing-internal.aliyuncs.com/mybucket/data/image.nc:hcc');
-- Specify the size per chunk and the compression format during the import process.
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"}');
-- Specify the degree of parallelism at import.
Select ST_ImportFrom('chunk_table','OSS://<ak>:<ak_secret>@oss-cn-beijing-internal.aliyuncs.com/mybucket/data/image.nc:hcc', '{}', '{"parallel": 4}');