st_translate 函数

适用于:已勾选“是”的 Databricks Runtime 17.1 及更高版本

Important

此功能目前以公共预览版提供。

使用提供的偏移量在 X、Y 和 Z 方向(如果指定)平移输入 GEOMETRY

Syntax

st_translate ( geoExpr, xfactor, yfactor[, zfactor] )

Arguments

  • geoExpr:一个 GEOMETRY 值。
  • xfactor:一个 DOUBLE 值,表示 X 方向的偏移量。
  • yfactor:一个 DOUBLE 值,表示 Y 方向的偏移量。
  • zfactor:一个 DOUBLE 值,表示 Z 方向的偏移量(可选)。 默认为 0。

Returns

一个GEOMETRY类型的值,代表已经转换的几何图形。

输出 GEOMETRY 值的 SRID 值等于输入值的 SRID 值。

输出 GEOMETRY 值的维度与输入值的维度相同。

如果任何输入为NULL,该函数将返回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)