Skip to main content

st_translate

Preview

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

Python
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

Python
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()
Output
[Row(result='SRID=4326;MULTIPOINT ZM ((11 22 3 -4),(15 26 7 -8),EMPTY)')]
Python
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()
Output
[Row(result='SRID=4326;MULTIPOINT ZM ((11 22 33 -4),(15 26 37 -8),EMPTY)')]