ST_ExportTo

更新时间:
复制 MD 格式

Exports a raster object to Object Storage Service (OSS) as an OSS object.

Syntax

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

Parameters

ParameterDescription
sourceThe raster object to export.
formatThe format of the exported file, such as GTiff or BMP. See Supported formats for all valid values.
urlThe OSS URL of the output object. For the URL format, see the url parameter description in ST_CreateRast.
levelThe pyramid level to export. Default value: 0.

Description

Returns true if the raster object is exported successfully, or false if the export fails.

Supported formats

The format parameter accepts the following GDAL driver codes:

Format codeFull 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

The following example retrieves a raster object from raster_table and exports it to OSS as a GeoTIFF file.

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';