Name

ST_Resample — 使用指定的重采样算法、新尺寸、任意栅格角以及从其他栅格定义或借用的一组栅格地理参考属性对栅格进行重采样。

Synopsis

raster ST_Resample(raster rast, integer width, integer height, double precision gridx=NULL, double precision gridy=NULL, double precision skewx=0, double precision skewy=0, text algorithm=NearestNeighbor, double precision maxerr=0.125);

raster ST_Resample(raster rast, double precision scalex=0, double precision scaley=0, double precision gridx=NULL, double precision gridy=NULL, double precision skewx=0, double precision skewy=0, text algorithm=NearestNeighbor, double precision maxerr=0.125);

raster ST_Resample(raster rast, raster ref, text algorithm=NearestNeighbor, double precision maxerr=0.125, boolean usescale=true);

raster ST_Resample(raster rast, raster ref, boolean usescale, text algorithm=NearestNeighbor, double precision maxerr=0.125);

描述

使用指定的重采样算法、新维度(宽度)重采样栅格 & 高度)、网格角(GRIDX & Gridy)和一组栅格地理配准属性(scalex、scaleY、skewx & Skewy)定义的或从另一个栅格借用的。如果使用参考栅格,则这两个栅格必须具有相同的SRID。

使用NearestNeighbor(英式或美式拼写)、双线性、立方、立方样条线或Lanczos重采样算法计算新的像素值。默认为NearestNeighbor,它是最快的,但生成的插补最差。

如果没有,则使用最大错误百分比0.125 maxerr 是指定的。

[Note]

请参阅: GDAL扭曲重采样方法 了解更多详细信息。

可用性:2.0.0需要GDAL 1.6.1+

已更改:已删除2.1.0参数sRID。具有参考栅格的变体不再应用参考栅格的SRID。使用ST_Transform()重新投影栅格。适用于没有SRID的栅格。

示例

SELECT
    ST_Width(orig) AS orig_width,
    ST_Width(reduce_100) AS new_width
FROM (
    SELECT
        rast AS orig,
        ST_Resample(rast,100,100) AS reduce_100
    FROM aerials.boston
    WHERE ST_Intersects(rast,
        ST_Transform(
            ST_MakeEnvelope(-71.128, 42.2392,-71.1277, 42.2397, 4326),26986)
    )
    LIMIT 1
) AS foo;

 orig_width | new_width
------------+-------------
        200 |         100
                

另请参阅

ST_Rescale, ST_Resize, ST_Transform