RS_Tile¶
Introduction: Returns an array of rasters resulting from the split of the input raster based upon the desired dimensions of the output rasters.
Format: RS_Tile(raster: Raster, width: Int, height: Int, padWithNoData: Boolean = false, noDataVal: Double = null)
Format: RS_Tile(raster: Raster, bandIndices: Array[Int], width: Int, height: Int, padWithNoData: Boolean = false, noDataVal: Double = null)
Since: v1.5.1
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. 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.
SQL example:
WITH raster_table AS (SELECT RS_MakeEmptyRaster(1, 6, 6, 300, 400, 10) rast)
SELECT RS_Tile(rast, 2, 2) AS tiles FROM raster_table
Output:
+--------------------+
| tiles|
+--------------------+
|[GridCoverage2D["...|
+--------------------+
User can use EXPLODE function to expand the array of tiles into a table of tiles.
WITH raster_table AS (SELECT RS_MakeEmptyRaster(1, 6, 6, 300, 400, 10) rast)
SELECT EXPLODE(RS_Tile(rast, 2, 2)) AS tile FROM raster_table
Output:
+--------------------+
| tile|
+--------------------+
|GridCoverage2D["g...|
|GridCoverage2D["g...|
|GridCoverage2D["g...|
|GridCoverage2D["g...|
|GridCoverage2D["g...|
|GridCoverage2D["g...|
|GridCoverage2D["g...|
|GridCoverage2D["g...|
|GridCoverage2D["g...|
+--------------------+