Name

ST_WorldToRasterCoordX — 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.

Synopsis

integer ST_WorldToRasterCoordX(raster rast, geometry pt);

integer ST_WorldToRasterCoordX(raster rast, double precision xw);

integer ST_WorldToRasterCoordX(raster rast, double precision xw, double precision yw);

Description

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.

Changed: 2.1.0 In prior versions, this was called ST_World2RasterCoordX

Examples

SELECT rid, ST_WorldToRasterCoordX(rast,3427927.8) As xcoord, 
		ST_WorldToRasterCoordX(rast,3427927.8,20.5) As xcoord_xwyw, 
		ST_WorldToRasterCoordX(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
				

See Also

ST_RasterToWorldCoordX, ST_RasterToWorldCoordY, ST_SRID