This function computes the pixel coordinates of a cell by using an inverse affine transformation formula based on the world coordinates and pyramid level of the cell.

Syntax

point ST_World2RastCoord(raster raster_obj, integer pyramidLevel, point coord);
geometry ST_World2RastCoord(raster raster_obj, integer pyramidLevel, geometry geom);

Parameters

Parameter Description
raster_obj The raster object.
pyramidLevel The pyramid level.
coord The world coordinates of the cell.
geom The geometry to be converted.

Description

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

A geometry will be returned. The x coordinate is the column number in raster and the y coordinate is the row number.

Example

Select ST_World2RastCoord(raster_obj, 0, '(27.9,128.6)') from raster_table;