Skip to content

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.

FunctionSyntax
Pythontransform(raster_col, sr)
SQLRT_Transform(raster_col, sr)
Scalatransform(raster, sr)

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

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.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
Use dark colors for code blocksCopy
1
2
3
4
5
+--------------------+--------+
|         transformed|new_srid|
+--------------------+--------+
|SqlRaster(1x2x2, ...|    3857|
+--------------------+--------+

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.