st_makepoint function
Applies to: Databricks Runtime 18.2 and above
Preview
This feature is in Public Preview.
Returns a point GEOMETRY value with the given coordinates. The function takes 2, 3, or 4 DOUBLE values, representing the (x, y), (x, y, z), or (x, y, z, m) coordinates of the point.
Syntax
st_makepoint ( x, y [, z [, m ] ] )
Arguments
x: ADOUBLEvalue, representing the first coordinate of the point.y: ADOUBLEvalue, representing the second coordinate of the point.z: An optionalDOUBLEvalue, representing the third (Z) coordinate of the point.m: An optionalDOUBLEvalue, representing the fourth (M) coordinate of the point.
Returns
A value of type GEOMETRY, representing a point with the specified coordinates.
The SRID value of the returned geometry is always 0.
The number of input coordinates determines the dimension of the returned point: 2D if you provide only x and y, 3DZ if you also provide z, or 4D if you provide all four coordinates (x, y, z, and m).
The function returns NULL if any of the inputs is NULL.
Examples
SQL
-- 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