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.
Applies to: Databricks Runtime 17.1 and above
Important
This feature is in Public Preview.
Translates the input GEOMETRY
in the X, Y, and, if specified, Z directions using the provided offsets.
Syntax
st_translate ( geoExpr, xfactor, yfactor[, zfactor] )
Arguments
geoExpr
: AGEOMETRY
value.xfactor
: ADOUBLE
value representing the offset in the X direction.yfactor
: ADOUBLE
value representing the offset in the Y direction.zfactor
: ADOUBLE
value representing the offset in the Z direction (optional). Default is 0.
Returns
A value of type GEOMETRY
, representing the translated geometry.
The SRID value of the output GEOMETRY
value is equal to that of the input value.
The dimension of the output GEOMETRY
value is the same as that of the input value.
The function returns NULL
if any of the inputs is NULL
.
Examples
-- Translates a point by 10 in the X direction and 20 in the Y direction.
> SELECT st_astext(_FUNC_(st_geomfromtext('MULTIPOINT ZM (1 2 3 -4,5 6 7 -8,EMPTY)'), 10.0, 20.0))
MULTIPOINT ZM ((11 22 3 -4),(15 26 7 -8),EMPTY)
-- Translates a point by 10 in the X direction, 20 in the Y direction, and 3 in the Z direction.
> SELECT st_astext(_FUNC_(st_geomfromtext('MULTIPOINT ZM (1 2 3 -4,5 6 7 -8,EMPTY)'), 10.0, 20.0, 30.0))
MULTIPOINT ZM ((11 22 33 -4),(15 26 37 -8),EMPTY)