Skip to main content
Creates a raster from the given array of pixel values. The width, height, geo-reference information, and the CRS will be taken from the given reference raster. The data type of the resulting raster will be DOUBLE and the number of bands of the resulting raster will be data.length / (refRaster.width * refRaster.height).

Signatures

RS_MakeRaster(rast: Raster, type: String, data: ARRAY[Double])

Parameters

rast
Raster
required
The reference raster from which width, height, geo-reference information, and CRS are taken.
type
String
required
The data type of the resulting raster bands.
data
ARRAY[Double]
required
The array of pixel values for the resulting raster.

Return type

The resulting raster.

Example

WITH r AS (SELECT RS_MakeEmptyRaster(2, 3, 2, 0.0, 0.0, 1.0, -1.0, 0.0, 0.0, 4326) AS rast)
SELECT RS_AsMatrix(RS_MakeRaster(rast, 'D', ARRAY(1, 2, 3, 4, 5, 6))) FROM r
+------------------------------------------------------------+
|rs_asmatrix(rs_makeraster(rast, D, array(1, 2, 3, 4, 5, 6)))|
+------------------------------------------------------------+
||1.0  2.0  3.0|\n|4.0  5.0  6.0|\n                          |
+------------------------------------------------------------+