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
| Parameter | Description |
|---|---|
| x | The x coordinate (longitude) of the point. |
| y | The y coordinate (latitude) of the point. |
| z | The z coordinate of the point. |
| m | The 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)该文章对您有帮助吗?