All Products
Search
Document Center

AnalyticDB:ST_SetGeoreference

Last Updated:Mar 28, 2026

Sets the geographic reference information (georeference) of a raster object by applying a six-parameter affine transformation and a spatial reference system identifier (SRID).

Syntax

raster ST_SetGeoreference(raster rast, integer srid, integer aop, double A, double B, double C, double D, double E, double F)

Parameters

ParameterTypeDescription
rastrasterThe raster object to update.
sridintegerThe SRID of the raster object. The SRID must exist in the spatial_ref_sys table.
aopintegerThe origin point of the affine transformation coordinates. Valid values: 1 (center of cell), 2 (upper-left corner of cell).
A, B, C, D, E, and FdoubleThe six parameters of an affine transformation.

The six parameters define the affine transformation formulas:

  • x = A × Column + B × Row + C

  • y = D × Column + E × Row + F

Usage notes

If the raster object is stored in external mode, the following constraints apply before calling this function:

  • The raster object must already be geographically referenced.

  • The specified SRID must exist in the spatial_ref_sys table.

If either condition is not met, the update fails and the raster object's georeference information is not changed.

Examples

The following example sets the georeference of the raster with id=1. The SRID is set to 4326 (WGS 84), with aop=1 (center-cell origin), a pixel width of 8.4163, a pixel height of -8.4163, and the center-cell origin at (124, 36.2).

UPDATE rast SET rast = ST_SetGeoreference(rast, 4326, 1, 8.4163, 0, 124, 0, -8.4163, 36.2) WHERE id = 1;

Output:

(1 row)