RS_TileExplode¶
Introduction: Generates records containing raster tiles resulting from the split of the input raster based upon the desired dimensions of the output rasters.
Format: RS_TileExplode(raster: Raster, width: Int, height: Int, padWithNoData: Boolean = false, noDataVal: Double = null)
Format: RS_TileExplode(raster: Raster, bandIndex: Int, width: Int, height: Int, padWithNoData: Boolean = false, noDataVal: Double = null)
Format: RS_TileExplode(raster: Raster, bandIndices: Array[Int], width: Int, height: Int, padWithNoData: Boolean = false, noDataVal: Double = null)
Since: v1.5.0
width and height specifies the size of generated tiles. If bandIndices is NULL or not specified, all bands will be included in the output tiles,
otherwise bands specified by bandIndices will be included. bandIndex can be specified if there is only one selected band, which is equivalent to
specifying bandIndices as ARRAY(bandIndex).Band indices are 1-based.
If padWithNoData = false, edge tiles on the right and bottom sides of the raster may have different dimensions than the rest of
the tiles. If padWithNoData = true, all tiles will have the same dimensions with the possibility that edge tiles being padded with
NODATA values. If raster band(s) do not have NODATA value(s) specified, one can be specified by setting noDataVal.
The returned records have the following schema:
x: The index of the tile along X axis (0-based).y: The index of the tile along Y axis (0-based).tile: The tile.
SQL example:
WITH raster_table AS (SELECT RS_MakeEmptyRaster(1, 6, 6, 300, 400, 10) rast)
SELECT RS_TileExplode(rast, 2, 2) FROM raster_table
Output:
+---+---+--------------------+
| x| y| tile|
+---+---+--------------------+
| 0| 0|GridCoverage2D["g...|
| 1| 0|GridCoverage2D["g...|
| 2| 0|GridCoverage2D["g...|
| 0| 1|GridCoverage2D["g...|
| 1| 1|GridCoverage2D["g...|
| 2| 1|GridCoverage2D["g...|
| 0| 2|GridCoverage2D["g...|
| 1| 2|GridCoverage2D["g...|
| 2| 2|GridCoverage2D["g...|
+---+---+--------------------+