ST_WorldToRasterCoord — Returns the upper left corner as column and row given geometric X and Y (longitude and latitude) or a point geometry expressed in the spatial reference coordinate system of the raster.
record ST_WorldToRasterCoord(
raster rast, geometry pt)
;
record ST_WorldToRasterCoord(
raster rast, double precision longitude, double precision latitude)
;
Returns the upper left corner as column and row given geometric X and Y (longitude and latitude) or a point geometry. This function works regardless of whether or not the geometric X and Y or point geometry is outside the extent of the raster. Geometric X and Y must be expressed in the spatial reference coordinate system of the raster.
Disponibilidad: 2.1.0
SELECT rid, (ST_WorldToRasterCoord(rast,3427927.8,20.5)).*, (ST_WorldToRasterCoord(rast,ST_GeomFromText('POINT(3427927.8 20.5)',ST_SRID(rast)))).* FROM dummy_rast; rid | columnx | rowy | columnx | rowy -----+---------+-----------+---------+----------- 1 | 1713964 | 7 | 1713964 | 7 2 | 2 | 115864471 | 2 | 115864471