All Products
Search
Document Center

ApsaraDB RDS:ST_ExportTo

Last Updated:Mar 28, 2026

Exports a raster object to Object Storage Service (OSS), Multi-Cloud Object Storage (MinIO), or Hadoop Distributed File System (HDFS).

Syntax

boolean ST_ExportTo(raster source,
  cstring format,
  cstring url,
  integer level = 0);

Parameters

ParameterDescription
sourceThe raster object to export.
formatThe output format. Common values include GTiff and BMP. For the full list of supported formats, see Supported formats.
urlThe destination URL for the exported OSS object, MinIO object, or HDFS file. Subset URLs are not supported. For URL syntax, see Object storage paths.
levelThe pyramid level. Default value: 0.

Supported formats

The following table lists common formats.

FormatFull name
BMPMicrosoft Windows Device Independent Bitmap (.bmp)
ECWERDAS Compressed Wavelets (.ecw)
EHdrESRI .hdr Labelled
GIFGraphics Interchange Format (.gif)
GPKGGeoPackage
GTiffTIFF/BigTIFF/GeoTIFF (.tif)
HDF4Hierarchical Data Format Release 4 (HDF4)
PDFGeospatial PDF
PNGPortable Network Graphics (.png)
COGCloud optimized GeoTIFF

To get the complete list of supported formats, call ST_RasterDrivers.

Return value

Returns true if the export succeeds, or false if it fails.

Examples

-- Export a raster object as an OSS object.
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.
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.
Select ST_ExportTo(raster, 'PNG', 'HDFS://<user_name>@10.0.XX.XX:8020/path/image.png')
from raster_table
where id=1;