Exports a raster object to an Object Storage Service (OSS) object, a Multi-Cloud Object Storage (MinIO) object, or a Hadoop Distributed File System (HDFS) file.
Syntax
boolean ST_ExportTo(raster source,
cstring format,
cstring url,
integer level = 0);Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| source | raster | — | The raster object to export. |
| format | cstring | — | The output format. Common values: GTiff, PNG. For the full list of supported formats, see Supported formats. |
| url | cstring | — | The destination path in OSS, MinIO, or HDFS. Subset URLs are not supported. For path syntax, see Object storage paths. |
| level | integer | 0 | The pyramid level to export. |
Supported formats
| Format | Full name |
|---|---|
| BMP | Microsoft Windows Device Independent Bitmap (.bmp) |
| ECW | ERDAS Compressed Wavelets (.ecw) |
| EHdr | ESRI .hdr Labelled |
| GIF | Graphics Interchange Format (.gif) |
| GPKG | GeoPackage |
| GTiff | TIFF/BigTIFF/GeoTIFF (.tif) |
| HDF4 | Hierarchical Data Format Release 4 (HDF4) |
| Geospatial PDF | |
| PNG | Portable Network Graphics (.png) |
| COG | Cloud Optimized GeoTIFF |
To get the complete list of supported drivers, call ST_RasterDrivers.
Return value
Returns true if the export succeeds. Returns false if the export fails.
Examples
Export a raster object as an OSS object in GeoTIFF format:
Select ST_ExportTo(raster, 'GTiff', 'OSS://<ak>:<ak_secret>@oss-cn-beijing-internal.aliyuncs.com/mybucket/data/image.tif')
from raster_table
where id=1;Export a raster object as a MinIO object in PNG format:
Select ST_ExportTo(raster, 'PNG', 'MIO://<ak>:<ak_secret>@10.0.XX.XX:443/mybucket/data/image.png')
from raster_table
where id=1;Export a raster object as an HDFS file in PNG format:
Select ST_ExportTo(raster, 'PNG', 'HDFS://<user_name>@10.0.XX.XX:8020/path/image.png')
from raster_table
where id=1;