ST_World2RasterCoordY — Returns the row 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_World2RasterCoordY(raster rast, geometry pt);
integer ST_World2RasterCoordY(raster rast, double precision xw);
integer ST_World2RasterCoordY(raster rast, double precision xw, double precision yw);
Returns the row 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_World2RasterCoordY(rast,20.5) As ycoord,
ST_World2RasterCoordY(rast,3427927.8,20.5) As ycoord_xwyw,
ST_World2RasterCoordY(rast,ST_GeomFromText('POINT(3427927.8 20.5)',ST_SRID(rast))) As ptycoord
FROM dummy_rast;
rid | ycoord | ycoord_xwyw | ptycoord
-----+-----------+-------------+-----------
1 | 7 | 7 | 7
2 | 115864471 | 115864471 | 115864471