ST_World2RasterCoordX — Returns the column in the raster of the point geometry (pt) or a X and Y world coordinate (xw, yw) represented in world spatial reference system of raster.
integer ST_World2RasterCoordX(
raster rast, geometry pt)
;
integer ST_World2RasterCoordX(
raster rast, double precision xw)
;
integer ST_World2RasterCoordX(
raster rast, double precision xw, double precision yw)
;
Returns the column in the raster of the point geometry (pt) or a X and Y world coordinate (xw, yw). A point, or (both xw and yw world coordinates are required if a raster is skewed). If a raster is not skewed then xw is sufficient. World coordinates are in the spatial reference coordinate system of the raster.
SELECT rid, ST_World2RasterCoordX(rast,3427927.8) As xcoord, ST_World2RasterCoordX(rast,3427927.8,20.5) As xcoord_xwyw, ST_World2RasterCoordX(rast,ST_GeomFromText('POINT(3427927.8 20.5)',ST_SRID(rast))) As ptxcoord FROM dummy_rast; rid | xcoord | xcoord_xwyw | ptxcoord -----+---------+---------+---------- 1 | 1713964 | 1713964 | 1713964 2 | 1 | 1 | 1