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 format of the exported data. Common values: GTiff, BMP. |
| url | The path of the external file. Subset is not supported. For more information, see Object storage paths. |
| level | The pyramid level. |
The format parameter specifies the name of the export format. Common formats are listed below.
| Name | Full name |
| BMP | Microsoft Windows Device Independent Bitmap(.bmp) |
| ECW | ERDAS Compressed Wavelets (.ecw) |
| EHdr | ESRI .hdr Labelled |
| GIF | Graphics InterchangeFormat(.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 |
Description
Returns true if the export succeeds and false if it fails.
You can call the ST_RasterDrivers function to query supported data types.
Examples
-- Export to OSS
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 to MinIO
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 to HDFS
Select ST_ExportTo(raster, 'PNG', 'HDFS://<user_name>@10.0.XX.XX:8020/path/image.png')
from raster_table
where id=1;