名称

ST_PixelWidth — 返回空间参考系统的几何单位中的像素宽度。

语法

double precision ST_PixelWidth(raster rast);

描述

返回空间参考系统的几何单位中的像素宽度。在没有倾斜的常见情况下,像素宽度只是几何坐标和光栅像素之间的比例。

下图演示了关系

像素宽度:i 方向的像素大小

像素高度:j 方向的像素大小

示例:没有倾斜的光栅

SELECT ST_Width(rast) As rastwidth, ST_PixelWidth(rast) As pixwidth,
    ST_ScaleX(rast) As scalex, ST_ScaleY(rast) As scaley, ST_SkewX(rast) As skewx,
    ST_SkewY(rast) As skewy
    FROM dummy_rast;

    rastwidth | pixwidth | scalex | scaley | skewx | skewy
    -----------+----------+--------+--------+-------+----------
    10 |        2 |      2 |      3 |     0 |        0
     5 |     0.05 |   0.05 |  -0.05 |     0 |        0
        

示例:倾斜度不为 0 的光栅

SELECT ST_Width(rast) As rastwidth, ST_PixelWidth(rast) As pixwidth,
    ST_ScaleX(rast) As scalex, ST_ScaleY(rast) As scaley, ST_SkewX(rast) As skewx,
    ST_SkewY(rast) As skewy
    FROM (SELECT ST_SetSkew(rast,0.5,0.5) As rast
    FROM dummy_rast) As skewed;

    rastwidth |     pixwidth      | scalex | scaley | skewx | skewy
    -----------+-------------------+--------+--------+-------+----------
    10 |  2.06155281280883 |      2 |      3 |   0.5 |      0.5
     5 | 0.502493781056044 |   0.05 |  -0.05 |   0.5 |      0.5
        

另请参阅

ST_PixelHeightST_ScaleXST_ScaleYST_SkewXST_SkewY