Skip to main content
Returns the X coordinate of the grid coordinate of the given world coordinates as an integer. RS_WorldToRasterCoordX

Signatures

RS_WorldToRasterCoordX(raster: Raster, point: Geometry)
RS_WorldToRasterCoordX(raster: Raster, x: Double, y: Double)

Parameters

raster
Raster
required
The input raster.
x
Double
The X coordinate (longitude).
y
Double
The Y coordinate (latitude).
point
Geometry
The point value.

Return type

An integer value.

Examples

SELECT RS_WorldToRasterCoordX(ST_MakeEmptyRaster(1, 5, 5, -53, 51, 1, -1, 0, 0), -53, 51) from rasters;
1
SELECT RS_WorldToRasterCoordX(ST_MakeEmptyRaster(1, 5, 5, -53, 51, 1, -1, 0, 0), ST_GeomFromText('POINT (-53 51)')) from rasters;
1
For non-skewed rasters, you can provide any value for latitude and the intended value of world longitude, to get the desired answer