ST_SnapToGrid — 通过将栅格捕捉到栅格来重采样栅格。使用NearestNeighbor(英式或美式拼写)、双线性、立方、立方样条线或Lanczos重采样算法计算新的像素值。默认值为NearestNeighbor。
raster
ST_SnapToGrid
(
raster
rast
, double precision
gridx
, double precision
gridy
, text
algorithm=NearestNeighbor
, double precision
maxerr=0.125
, double precision
scalex=DEFAULT 0
, double precision
scaley=DEFAULT 0
)
;
raster
ST_SnapToGrid
(
raster
rast
, double precision
gridx
, double precision
gridy
, double precision
scalex
, double precision
scaley
, text
algorithm=NearestNeighbor
, double precision
maxerr=0.125
)
;
raster
ST_SnapToGrid
(
raster
rast
, double precision
gridx
, double precision
gridy
, double precision
scalexy
, text
algorithm=NearestNeighbor
, double precision
maxerr=0.125
)
;
通过将栅格捕捉到由任意像素角(GRIDX)定义的格网来重采样栅格 & Gridy)和可选的像素大小(scalex & Scale Ey)。使用NearestNeighbor(英式或美式拼写)、双线性、立方、立方样条线或Lanczos重采样算法计算新的像素值。默认值为NearestNeighbor,它是最快的,但结果是最差的插值。
gridx
和
gridy
定义新网格的任意像素角。这不一定是新栅格的左上角,也不一定在新栅格范围的内部或边缘。
您可以选择使用定义新格网的像素大小
scalex
和
scaley
。
新栅格的范围将包含提供的栅格的范围。
如果否,则最大错误百分比为0.125
maxerr
是指定的。
![]() |
|
请参阅: GDAL扭曲重采样方法 了解更多详细信息。 |
![]() |
|
使用 ST_Resample 如果您需要对栅格参数进行更多控制。 |
可用性:2.0.0需要GDAL 1.6.1+
已更改:2.1.0适用于没有SRID的栅格
将栅格捕捉到略有不同的栅格的简单示例。
-- the original raster upper left X
SELECT ST_UpperLeftX(ST_AddBand(ST_MakeEmptyRaster(10, 10, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BUI'::text, 1, 0));
-- result
0
-- the upper left of raster after snapping
SELECT ST_UpperLeftX(ST_SnapToGrid(ST_AddBand(ST_MakeEmptyRaster(10, 10, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BUI'::text, 1, 0), 0.0002, 0.0002));
--result
-0.0008