Skip to content

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.

FunctionSyntax
Pythonsrid(raster_col, srid=None)
SQLRT_SRID(raster_col, srid)
Scalasrid(raster, srid)

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

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, "int32"))

df.select(RT.srid("raster", 4326).alias("raster")) \
  .withColumn("srid", RT.srid("raster")).show()
Result
Use dark colors for code blocksCopy
1
2
3
4
5
+--------------------+----+
|              raster|srid|
+--------------------+----+
|SqlRaster(1x2x2, ...|4326|
+--------------------+----+

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.