The ST_ImportFrom function is used to import an Object Storage Service (OSS) object into a raster object in Ganos.

Syntax

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

Parameters

Parameter Description
chunkTableName The name of the chunk table. The name must comply with the table naming conventions of Ganos.
url The URL of the OSS object. For more information, see the "Parameters" section in ST_CreateRast.
storageOption A JSON string that is used to specify the storage information of the raster object.
importOption A JSON string that is used to specify the import-related parameters.
The following table describes the parameters that you can specify in the storageOption parameter.
Parameter Type Default value Description
chunking boolean true Specifies whether to store the new raster object as chunks.
chunkdim string The value is the same as the value in the original configuration data. The dimensions that are used to store the new raster object as chunks. 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 new raster object. Valid values:
  • none
  • jpeg
  • zlib
  • png
  • lzo
  • lz4
  • snappy
  • zstd
  • jp2k
quality integer 75 The quality of compression of the new raster object. This parameter takes effect only when you set the compression parameter to jpeg or jp2k.
interleaving string The value is the same as the value of the original configuration data. The interleaving type of the new raster 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 The value is the same as the value of the original configuration data. The pixel type of the new raster object. Valid values:
  • 1bb: 1-bit integer
  • 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 floating number
  • 64bsi : 64-bit signed integer
  • 64bui : 64-bit unsigned integer
  • 64bf : 64-bit floating number
The following table describes the parameters that you can specify in the importOption parameter.
Parameter Type Default value Description
mapping_oss_file boolean false. Specifies whether to map the OSS object to an in-memory file in Ganos.
Note When the OSS object is imported into Ganos, some drivers do not optimize the data of the object. As a result, a large number of requests are initiated to query small amounts of data, and the import speed is reduced. You can use this parameter to map the OSS object to an in-memory file in Ganos. This way, the import speed is increased. The maximum size of the OSS object is specified by the ganos.raster.memory_oss_file_max_size GUC parameter. For more information about this parameter, see ganos.raster.memory_oss_file_max_size.
parallel integer The value of the ganos.parallel.degree GUC parameter. For more information, see ganos.parallel.degree. The degree of parallelism that is allowed. Valid values: 1 to 64.

Description

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

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

Examples

-- Import an OSS object for which you specify only the name and the path.
Select ST_ImportFrom('chunk_table','OSS://<ak>:<ak_secret>@oss-cn-beijing-internal.aliyuncs.com/mybucket/data/image.tif');

-- Import 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');

-- Import an OSS object for which you specify the size per chunk and the compression format.
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 an OSS object for which you specify the degree of parallelism.
Select ST_ImportFrom('chunk_table','OSS://<ak>:<ak_secret>@oss-cn-beijing-internal.aliyuncs.com/mybucket/data/image.nc:hcc', '{}', '{"parallel": 4}');