st_scale
function
Applies to: Databricks Runtime 17.1 and above
Preview
This feature is in Public Preview.
Scales the input GEOMETRY
in the X, Y, and, if specified, Z directions using the provided scaling factors.
Syntax
st_scale ( geoExpr, xfactor, yfactor[, zfactor] )
Arguments
geoExpr
: AGEOMETRY
value.xfactor
: ADOUBLE
value representing the X scaling factor.yfactor
: ADOUBLE
value representing the Y scaling factor.zfactor
: ADOUBLE
value representing the Z scaling factor (optional). Default is 1.
Returns
A value of type GEOMETRY
, representing the scaled 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
SQL
-- Scales a point by 10 in the X direction and 20 in the Y direction.
> SELECT st_astext(st_scale(st_geomfromtext('MULTIPOINT ZM (1 2 3 -4,5 6 7 -8,EMPTY)'), 10.0, 20.0));
MULTIPOINT ZM ((10 40 3 -4),(50 120 7 -8),EMPTY)
-- Scales a point by 10 in the X direction, 20 in the Y direction, and 3 in the Z direction.
> SELECT st_astext(st_scale(st_geomfromtext('MULTIPOINT ZM (1 2 3 -4,5 6 7 -8,EMPTY)'), 10.0, 20.0, 3.0));
MULTIPOINT ZM ((10 40 9 -4),(50 120 21 -8),EMPTY)