ST_Tile — 根据输出栅格的所需尺寸,返回拆分输入栅格后生成的一组栅格。
setof raster ST_Tile(
raster rast, int[] nband, integer width, integer height, boolean padwithnodata=FALSE, double precision nodataval=NULL)
;
setof raster ST_Tile(
raster rast, integer nband, integer width, integer height, boolean padwithnodata=FALSE, double precision nodataval=NULL)
;
setof raster ST_Tile(
raster rast, integer width, integer height, boolean padwithnodata=FALSE, double precision nodataval=NULL)
;
根据输出栅格的所需尺寸,返回拆分输入栅格后生成的一组栅格。
如果 padwithnodata
= FALSE,则栅格右侧和底部的边缘图块的尺寸可能与其他图块不同。如果 padwithnodata
= TRUE,则所有图块的尺寸都相同,但边缘图块可能会填充 NODATA 值。如果栅格波段未指定 NODATA 值,则可以通过设置 nodataval
来指定一个 NODATA 值。
如果输入栅格的指定波段为 out-of-db,则输出栅格中的相应波段也将为 out-of-db。 |
可用性:2.1.0
WITH foo AS ( SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 0, 0, 1, -1, 0, 0, 0), 1, '8BUI', 1, 0), 2, '8BUI', 10, 0) AS rast UNION ALL SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 3, 0, 1, -1, 0, 0, 0), 1, '8BUI', 2, 0), 2, '8BUI', 20, 0) AS rast UNION ALL SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 6, 0, 1, -1, 0, 0, 0), 1, '8BUI', 3, 0), 2, '8BUI', 30, 0) AS rast UNION ALL SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 0, -3, 1, -1, 0, 0, 0), 1, '8BUI', 4, 0), 2, '8BUI', 40, 0) AS rast UNION ALL SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 3, -3, 1, -1, 0, 0, 0), 1, '8BUI', 5, 0), 2, '8BUI', 50, 0) AS rast UNION ALL SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 6, -3, 1, -1, 0, 0, 0), 1, '8BUI', 6, 0), 2, '8BUI', 60, 0) AS rast UNION ALL SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 0, -6, 1, -1, 0, 0, 0), 1, '8BUI', 7, 0), 2, '8BUI', 70, 0) AS rast UNION ALL SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 3, -6, 1, -1, 0, 0, 0), 1, '8BUI', 8, 0), 2, '8BUI', 80, 0) AS rast UNION ALL SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 6, -6, 1, -1, 0, 0, 0), 1, '8BUI', 9, 0), 2, '8BUI', 90, 0) AS rast ), bar AS ( SELECT ST_Union(rast) AS rast FROM foo ), baz AS ( SELECT ST_Tile(rast, 3, 3, TRUE) AS rast FROM bar ) SELECT ST_DumpValues(rast) FROM baz; st_dumpvalues ------------------------------------------ (1,"{{1,1,1},{1,1,1},{1,1,1}}") (2,"{{10,10,10},{10,10,10},{10,10,10}}") (1,"{{2,2,2},{2,2,2},{2,2,2}}") (2,"{{20,20,20},{20,20,20},{20,20,20}}") (1,"{{3,3,3},{3,3,3},{3,3,3}}") (2,"{{30,30,30},{30,30,30},{30,30,30}}") (1,"{{4,4,4},{4,4,4},{4,4,4}}") (2,"{{40,40,40},{40,40,40},{40,40,40}}") (1,"{{5,5,5},{5,5,5},{5,5,5}}") (2,"{{50,50,50},{50,50,50},{50,50,50}}") (1,"{{6,6,6},{6,6,6},{6,6,6}}") (2,"{{60,60,60},{60,60,60},{60,60,60}}") (1,"{{7,7,7},{7,7,7},{7,7,7}}") (2,"{{70,70,70},{70,70,70},{70,70,70}}") (1,"{{8,8,8},{8,8,8},{8,8,8}}") (2,"{{80,80,80},{80,80,80},{80,80,80}}") (1,"{{9,9,9},{9,9,9},{9,9,9}}") (2,"{{90,90,90},{90,90,90},{90,90,90}}") (18 rows)
WITH foo AS ( SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 0, 0, 1, -1, 0, 0, 0), 1, '8BUI', 1, 0), 2, '8BUI', 10, 0) AS rast UNION ALL SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 3, 0, 1, -1, 0, 0, 0), 1, '8BUI', 2, 0), 2, '8BUI', 20, 0) AS rast UNION ALL SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 6, 0, 1, -1, 0, 0, 0), 1, '8BUI', 3, 0), 2, '8BUI', 30, 0) AS rast UNION ALL SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 0, -3, 1, -1, 0, 0, 0), 1, '8BUI', 4, 0), 2, '8BUI', 40, 0) AS rast UNION ALL SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 3, -3, 1, -1, 0, 0, 0), 1, '8BUI', 5, 0), 2, '8BUI', 50, 0) AS rast UNION ALL SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 6, -3, 1, -1, 0, 0, 0), 1, '8BUI', 6, 0), 2, '8BUI', 60, 0) AS rast UNION ALL SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 0, -6, 1, -1, 0, 0, 0), 1, '8BUI', 7, 0), 2, '8BUI', 70, 0) AS rast UNION ALL SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 3, -6, 1, -1, 0, 0, 0), 1, '8BUI', 8, 0), 2, '8BUI', 80, 0) AS rast UNION ALL SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 6, -6, 1, -1, 0, 0, 0), 1, '8BUI', 9, 0), 2, '8BUI', 90, 0) AS rast ), bar AS ( SELECT ST_Union(rast) AS rast FROM foo ), baz AS ( SELECT ST_Tile(rast, 3, 3, 2) AS rast FROM bar ) SELECT ST_DumpValues(rast) FROM baz; st_dumpvalues ------------------------------------------ (1,"{{10,10,10},{10,10,10},{10,10,10}}") (1,"{{20,20,20},{20,20,20},{20,20,20}}") (1,"{{30,30,30},{30,30,30},{30,30,30}}") (1,"{{40,40,40},{40,40,40},{40,40,40}}") (1,"{{50,50,50},{50,50,50},{50,50,50}}") (1,"{{60,60,60},{60,60,60},{60,60,60}}") (1,"{{70,70,70},{70,70,70},{70,70,70}}") (1,"{{80,80,80},{80,80,80},{80,80,80}}") (1,"{{90,90,90},{90,90,90},{90,90,90}}") (9 rows)