Skip to content
πŸŽ‰ Apache Sedona 1.9.1 is out now! πŸ—ΊοΈ Geography SQL functions, Box2D & Box3D types, raster Python UDFs & more. Read the release notes β†’

RS_PixelAsPoint

Introduction: Returns a point geometry of the specified pixel's upper-left corner. The pixel coordinates specified are 1-indexed. If colX and rowY are out of bounds for the raster, they are extrapolated assuming the same skew and translate values.

RS_PixelAsPoint

Format: RS_PixelAsPoint(raster: Raster, colX: Integer, rowY: Integer)

Return type: Geometry

Since: v1.5.0

SQL Example

SELECT ST_AsText(RS_PixelAsPoint(raster, 2, 1)) from rasters

Output:

POINT (123.19, -12)

SQL Example

Out of the grid, the coordinate is extrapolated rather than rejected. The raster below is 5 pixels wide, so column 6 is the first column past its right edge, and that column's upper-left corner lies on the edge itself (x = 123 + 5 Γ— 8 = 163):

SELECT ST_AsText(RS_PixelAsPoint(RS_MakeEmptyRaster(1, 5, 10, 123, -230, 8), 6, 2))

Output:

POINT (163 -238)