ST_Resample — 使用指定的重採樣演算法、新的尺寸、任意網格角點以及一組從另一個點陣定義或借用的點陣地理參考屬性,來重新採樣點陣。
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 (最近鄰)
Bilinear (雙線性)
Cubic (三次)
CubicSpline (三次樣條)
Lanczos (蘭索斯)
Max (最大值)
Min (最小值)
預設值為 NearestNeighbor,它是最快的,但會產生最差的內插。
如果未指定 maxerr
,則會使用 0.125 的最大誤差百分比。
![]() |
|
有關詳細資訊,請參閱:GDAL Warp 重採樣方法。 |
可用性:2.0.0 需要 GDAL 1.6.1+
增強功能:3.4.0 新增了 max 和 min 重採樣選項
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