ST_RasterToWorldCoordX — 返回栅格左上角的几何 X 坐标,以及列和行号。列和行的编号从 1 开始。
float8 ST_RasterToWorldCoordX(
raster rast, integer xcolumn)
;
float8 ST_RasterToWorldCoordX(
raster rast, integer xcolumn, integer yrow)
;
返回地理参考栅格中栅格列行的左上角 X 坐标,单位为几何单位。列和行的编号从 1 开始,但如果您传递负数或大于栅格中列数的数字,它将给出栅格文件外部的坐标,并假设倾斜和像素大小与选定的栅格相同。
对于非倾斜栅格,提供 X 列就足够了。对于倾斜栅格,地理参考坐标是 ST_ScaleX 和 ST_SkewX 以及行和列的函数。如果您只为倾斜栅格提供 X 列,则会引发错误。 |
更改:2.1.0 在之前的版本中,这被称为 ST_Raster2WorldCoordX
-- non-skewed raster providing column is sufficient SELECT rid, ST_RasterToWorldCoordX(rast,1) As x1coord, ST_RasterToWorldCoordX(rast,2) As x2coord, ST_ScaleX(rast) As pixelx FROM dummy_rast; rid | x1coord | x2coord | pixelx -----+------------+-----------+-------- 1 | 0.5 | 2.5 | 2 2 | 3427927.75 | 3427927.8 | 0.05
-- for fun lets skew it SELECT rid, ST_RasterToWorldCoordX(rast, 1, 1) As x1coord, ST_RasterToWorldCoordX(rast, 2, 3) As x2coord, ST_ScaleX(rast) As pixelx FROM (SELECT rid, ST_SetSkew(rast, 100.5, 0) As rast FROM dummy_rast) As foo; rid | x1coord | x2coord | pixelx -----+------------+-----------+-------- 1 | 0.5 | 203.5 | 2 2 | 3427927.75 | 3428128.8 | 0.05