ST_MakePoint

更新时间:
复制 MD 格式

Constructs a 2D, 3DZ, or 4D point geometry from the given coordinates. For 3DM point geometries, use ST_MakePointM instead.

Syntax

geometry ST_MakePoint(double precision x, double precision y);
geometry ST_MakePoint(double precision x, double precision y, double precision z);
geometry ST_MakePoint(double precision x, double precision y, double precision z, double precision m);

Parameters

ParameterDescription
xThe x coordinate (longitude) of the point.
yThe y coordinate (latitude) of the point.
zThe z coordinate of the point.
mThe m coordinate of the point.

Usage notes

  • ST_MakePoint constructs geometry objects faster and more accurately than ST_GeomFromText and ST_PointFromText.

  • ST_MakePoint retains the z coordinate of the constructed geometry object.

  • To construct a 3DM point geometry, use ST_MakePointM.

Examples

Construct a 2D point:

SELECT ST_AsText(ST_MakePoint(1,2));
 st_astext
------------
 POINT(1 2)
(1 row)

Construct a 3DZ point:

SELECT ST_AsText(ST_MakePoint(1,2,3));
    st_astext
-----------------
 POINT Z (1 2 3)
(1 row)

Construct a 4D point:

SELECT ST_AsText(ST_MakePoint(1,2,3,4));
     st_astext
--------------------
 POINT ZM (1 2 3 4)
(1 row)