Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
This feature is in Public Preview.
Translates the input geometry in the X, Y, and Z (optional) directions using the provided offsets.
For the corresponding Databricks SQL function, see st_translate function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.st_translate(col1=<col1>, col2=<col2>, col3=<col3>, col4=<col4>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col1 |
pyspark.sql.Column or str |
A Geometry value. |
col2 |
pyspark.sql.Column or float |
A DOUBLE value representing the offset in the X direction. |
col3 |
pyspark.sql.Column or float |
A DOUBLE value representing the offset in the Y direction. |
col4 |
pyspark.sql.Column or float, optional |
A DOUBLE value representing the offset in the Z direction (optional). Default is 0. |
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('MULTIPOINT ZM (1 2 3 -4,5 6 7 -8,EMPTY)',)], ['wkt'])
df.select(dbf.st_asewkt(dbf.st_translate(dbf.st_geomfromtext('wkt', 4326), 10.0, 20.0)).alias('result')).collect()
[Row(result='SRID=4326;MULTIPOINT ZM ((11 22 3 -4),(15 26 7 -8),EMPTY)')]
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('MULTIPOINT ZM (1 2 3 -4,5 6 7 -8,EMPTY)',)], ['wkt'])
df.select(dbf.st_asewkt(dbf.st_translate(dbf.st_geomfromtext('wkt', 4326), 10.0, 20.0, 30.0)).alias('result')).collect()
[Row(result='SRID=4326;MULTIPOINT ZM ((11 22 33 -4),(15 26 37 -8),EMPTY)')]