Returns the grid coordinate of the given world coordinates as a Point.
Signatures
RS_WorldToRasterCoord(raster: Raster, point: Geometry)
RS_WorldToRasterCoord(raster: Raster, x: Double, y: Point)
Parameters
The X coordinate (longitude).
The Y coordinate (latitude).
Return type
Examples
SELECT RS_WorldToRasterCoord(ST_MakeEmptyRaster(1, 5, 5, -53, 51, 1, -1, 0, 0, 4326), -53, 51) from rasters;
SELECT RS_WorldToRasterCoord(ST_MakeEmptyRaster(1, 5, 5, -53, 51, 1, -1, 0, 0, 4326), ST_GeomFromText('POINT (-52 51)')) from rasters;
If the given geometry point is not in the same CRS as the given raster, the given geometry will be transformed to the given raster’s CRS. You can use ST_Transform to transform the geometry beforehand.