RT_SRID can work as a getter or a setter, depending on the inputs.
Getter: RT_SRID takes a raster column and returns the spatial reference ID (SRID) of the column as an integer column.
If the spatial reference of the input raster column has not been set, the function returns 0.
Setter: RT_SRID takes a raster column and a numeric or string value which represents the spatial reference ID (SRID) and returns the input geometry column with its SRID set to the numeric value. This does not affect the raster data in the column. To transform your raster from one spatial reference to another, use RT_Transform. This also does not affect the extent of the output raster column, to set the extent of your raster column, use RT_SetExtent.
| Function | Syntax |
|---|---|
| Python | srid(raster |
| SQL | RT |
| Scala | srid(raster, srid) |
For more details, go to the GeoAnalytics Engine API reference for srid.
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.srid("raster", 4326).alias("raster")) \
.withColumn("srid", RT.srid("raster")).show()+--------------------+----+
| raster|srid|
+--------------------+----+
|SqlRaster(1x2x2, ...|4326|
+--------------------+----+Version table
| Release | Notes |
|---|---|
2.0.0 | Python, SQL, and Scala functions introduced |