RT_PixelType takes a raster column and returns a string column that represents the data type of the cell. Cell values can be either positive or negative, integer, or floating point. Cells can also have a NoData value to represent the absence of data.
The supported pixel types are: uint1, uint2, uint4, uint8, uint16, uint32, int8, int16, int32, float32 and float64.
The short version of pixel type is also supported. For example, u1 can be used instead of uint1 or f32 instead of float32.
Also, the pixel type representation is bit-based. For example, u1 is one bit and not one byte, which means that it uses one bit per pixel.
| Function | Syntax |
|---|---|
| Python | pixel |
| SQL | RT |
| Scala | pixel |
For more details, go to the GeoAnalytics Engine API reference for pixel_type.
Examples
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, "int32"))
df.select(RT.pixel_type("raster").alias("pixel_type")).show()+----------+
|pixel_type|
+----------+
| Int32|
+----------+Version table
| Release | Notes |
|---|---|
2.0.0 | Python, SQL, and Scala functions introduced |