Exports a raster object to an Object Storage Service (OSS) bucket, a Multi-Cloud Object Storage (MinIO) bucket, or a Hadoop Distributed File System (HDFS) file.
Syntax
boolean ST_ExportTo(raster source,
cstring format,
cstring url,
integer level = 0);Parameters
| Parameter | Description |
|---|---|
| source | The raster object to export. |
| format | The output format. Common values: GTiff, PNG, BMP. For a full list of supported formats, see the Supported formats table below. |
| url | The destination URL of the exported OSS object, MinIO object, or HDFS file. Subset URLs are not supported. For URL syntax, see Object storage paths. |
| level | The pyramid level. Default value: 0. |
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 query all supported formats at runtime, call ST_RasterDrivers.
Return value
Returns true if the export succeeds, false if it fails.
Examples
Export a raster object to OSS in GTiff 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 to MinIO 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 to HDFS 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;