ST_Rast2WorldCoord

更新时间: 2026-12-02 13:59:26

Converts pixel coordinates in a raster to world (geographic) coordinates using an affine transformation formula based on the pixel coordinates and pyramid level of the cell.

Syntax

point ST_Rast2WorldCoord(raster raster_obj, integer pyramidLevel, integer row, integer column);
geometry ST_Rast2WorldCoord(raster raster_obj, integer pyramidLevel, geometry geom);

Two overloads are available:

  • Row/column variant: takes a row number and a column number, and returns a point.

  • Geometry variant: takes a geometry value where the x coordinate maps to the column number and the y coordinate maps to the row number, and returns a geometry.

Parameters

Parameter Description
raster_obj The raster object. Must have a valid spatial reference system identifier (SRID).
pyramidLevel The pyramid level of the raster.
row The row number of the cell. Used in the row/column variant.
column The column number of the cell. Used in the row/column variant.
geom The geometry to convert. The x coordinate represents the column number and the y coordinate represents the row number in the raster. Used in the geometry variant.

Description

The raster object must have a valid spatial reference system identifier (SRID).

Examples

Row/column variant — returns a point:

SELECT ST_Rast2WorldCoord(raster_obj, 0, 3, 4) FROM raster_table;

Output:

 st_rast2worldcoord
--------------------
 (440960,3751140)

Geometry variant — returns a geometry:

SELECT ST_AsText(ST_Rast2WorldCoord(raster_obj, 0, 'POINT(4 3)'::geometry)) FROM raster_table;

Output:

      st_astext
-----------------------
 POINT(440960 3751140)
In the geometry variant, POINT(4 3) means column 4, row 3 — matching the row/column variant above.

See also

上一篇: Coordinate system conversion 下一篇: ST_World2RastCoord