RT_Transform takes a raster column and a string column which represents the spatial reference value and returns a raster column. The function returns the input raster transformed into the specified spatial reference. It will also set the spatial reference of the result column.
The function will return null if the input raster does not have a spatial reference.
| Function | Syntax |
|---|---|
| Python | transform(raster |
| SQL | RT |
| Scala | transform(raster, sr) |
For more details, go to the GeoAnalytics Engine API reference for transform.
Examples
from geoanalytics.raster import functions as RT
data = [([1,2,3,4], )]
df = spark.createDataFrame(data, ["pixels"]) \
.withColumn("raster", RT.srid(RT.create_raster("pixels", 2, 2, "int32"), 4326))
df.select(RT.transform("raster", 3857).alias("transformed")) \
.withColumn("new_srid", RT.srid("transformed")).show()Result
+--------------------+--------+
| transformed|new_srid|
+--------------------+--------+
|SqlRaster(1x2x2, ...| 3857|
+--------------------+--------+Version table
| Release | Notes |
|---|---|
2.0.0 | Python, SQL, and Scala functions introduced |