ST_Raster2WorldCoordY — Returns the geometric Y coordinate upper left corner of a raster, column and row. Numbering of columns and rows starts at 1.
float8 ST_Raster2WorldCoordY(
raster rast, integer yrow)
;
float8 ST_Raster2WorldCoordY(
raster rast, integer xcolumn, integer yrow)
;
Returns the upper left Y coordinate of a raster column row in geometric units of the georeferenced raster. Numbering of columns and rows starts at 1 but if you pass in a negative number or number higher than number of columns/rows in raster, it will give you coordinates outside of the raster file to left or right with the assumption that the skew and pixel sizes are same as selected raster tile.
For non-skewed rasters, providing the Y column is sufficient. For skewed rasters, the georeferenced coordinate is a function of the ST_ScaleY and ST_SkewY and row and column. An error will be raised if you give just the Y row for a skewed raster. |
-- non-skewed raster providing row is sufficient SELECT rid, ST_Raster2WorldCoordY(rast,1) As y1coord, ST_Raster2WorldCoordY(rast,3) As y2coord, ST_ScaleY(rast) As pixely FROM dummy_rast; rid | y1coord | y2coord | pixely -----+---------+-----------+-------- 1 | 0.5 | 6.5 | 3 2 | 5793244 | 5793243.9 | -0.05
-- for fun lets skew it SELECT rid, ST_Raster2WorldCoordY(rast,1,1) As y1coord, ST_Raster2WorldCoordY(rast,2,3) As y2coord, ST_ScaleY(rast) As pixely FROM (SELECT rid, ST_SetSkew(rast,0,100.5) As rast FROM dummy_rast) As foo; rid | y1coord | y2coord | pixely -----+---------+-----------+-------- 1 | 0.5 | 107 | 3 2 | 5793244 | 5793344.4 | -0.05