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

Syntax

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

Parameters

ParameterDescription
sourceThe raster object to be exported.
formatThe format of the exported data, such as GTiff or BMP.
urlThe URL of the exported OSS object. For more information, see the description of the url parameter in ST_CreateRast.
levelThe pyramid level.

Description

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.

FormatFull name
BMPMicrosoft Windows Device Independent Bitmap(.bmp)
EHdrESRI .hdr Labelled
ENVIENVI .hdr Labelled Raster
GTiffTIFF/BigTIFF/GeoTIFF(.tif)
HFAErdas Imagine .img
RSTIdrisi Raster Format
INGRIntergraph Raster Format

Examples

DO $$
declare
    rast raster;
begin
    select raster_obj into rast from raster_table where id = 1;
    Select ST_ExportTo(rast, 'GTiff', 'OSS://ABCDEFG:1234567890@oss-cn-beijing-internal.aliyuncs.com/mybucket/data/4.tif');
end;    
$$ LANGUAGE 'plpgsql';