This function exports a raster object as an Object Storage Service (OSS) object.


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


Parameter Description
source The raster object to be exported.
format The format of the exported data, such as GTiff or BMP.
url The URL of the exported OSS object. For more information, see the description of the url parameter in ST_CreateRast.
level The pyramid level.


If the raster object is successfully exported, the function returns true. If the raster object fails to be exported, the function returns false.

The format parameter specifies the format of the exported data. The following table lists the common raster formats.

Format Full name
BMP Microsoft Windows Device Independent Bitmap(.bmp)
EHdr ESRI .hdr Labelled
ENVI ENVI .hdr Labelled Raster
GTiff TIFF/BigTIFF/GeoTIFF(.tif)
HFA Erdas Imagine .img
RST Idrisi Raster Format
INGR Intergraph Raster Format


DO $$
    rast raster;
    select raster_obj into rast from raster_table where id = 1;
    Select ST_ExportTo(rast, 'GTiff', 'OSS://');
$$ LANGUAGE 'plpgsql';