适用于:
Databricks Runtime 18.2 及更高版本
Important
此功能目前以公共预览版提供。
返回具有给定坐标的点 GEOMETRY 值。 该函数采用 2、3 或 4 DOUBLE 个值,表示点的(x、y)、(x、y、z)或(x、y、z、m)坐标。
Syntax
st_makepoint ( x, y [, z [, m ] ] )
Arguments
-
x:一个DOUBLE值,表示点的第一个坐标。 -
y:一个DOUBLE值,表示该点的第二个坐标。 -
z:一个可选DOUBLE值,表示该点的第三个(Z)坐标。 -
m:一个可选DOUBLE值,表示点的第四个 (M) 坐标。
Returns
类型的 GEOMETRY值,表示具有指定坐标的点。
返回的几何图形的 SRID 值始终 0为 .
输入坐标的数目决定了返回点的维度:2D(如果仅 x 提供), y如果同时提供,则为 3DZ;如果提供 z所有四个坐标(x、 y、 z和 m),则为 4D。
如果任何输入为NULL,该函数将返回NULL。
示例
-- Creates a 2D point with coordinates (10, 34).
> SELECT st_astext(st_makepoint(10.0, 34.0));
POINT(10 34)
-- Creates a 3DZ point with coordinates (1, 2, 3).
> SELECT st_astext(st_makepoint(1.0, 2.0, 3.0));
POINT Z (1 2 3)
-- Creates a 4D point with coordinates (1, 2, 3, 4).
> SELECT st_astext(st_makepoint(1.0, 2.0, 3.0, 4.0));
POINT ZM (1 2 3 4)
-- The SRID of the returned geometry is always 0.
> SELECT st_srid(st_makepoint(10.0, 34.0));
0
-- The type of the returned geometry is always geometry(0).
> SELECT typeof(st_makepoint(10.0, 34.0));
geometry(0)
-- The function returns NULL if any of the inputs is NULL.
> SELECT st_astext(st_makepoint(10.0, NULL));
NULL