Skip to content

RT_Materialize takes a raster column and returns a raster column. Raster columns returned by the datasource may be lazily evaluated reference rasters, only holding the source file path and a tile offset. This function will force evaluation of that reference and load its pixels into memory. This is useful for repeated calculations like RT_ZonalStatistics where the same raster may be needed for multiple polygons and materializing the raster ahead of the statistics calculation will avoid duplicate reads. For more information see raster references.

FunctionSyntax
Pythonmaterialize(raster_col)
SQLRT_Materialize(raster_col)
Scalamaterialize(raster)

For more details, go to the GeoAnalytics Engine API reference for materialize.

Examples

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9

from geoanalytics.raster import functions as RT

data = [([1,2,3,4], )]
df = spark.createDataFrame(data, ["pixels"]) \
     .withColumn("raster", RT.create_raster("pixels", 2, 2, "float32"))

df_materialize = df.select(RT.materialize("raster").alias("materialize"))
df_materialize.withColumn("materialize_pixels", RT.band_values("materialize", 1)).show(truncate=False)
Result
Use dark colors for code blocksCopy
1
2
3
4
5
+-------------------------+--------------------+
|materialize              |materialize_pixels  |
+-------------------------+--------------------+
|SqlRaster(1x2x2, Float32)|[1.0, 2.0, 3.0, 4.0]|
+-------------------------+--------------------+

Version table

ReleaseNotes

2.0.0

Python, SQL, and Scala functions introduced

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.