Name

ST_MakePoint — Creates a 2D,3DZ or 4D point geometry.

Synopsis

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);

Description

Creates a 2D,3DZ or 4D point geometry (geometry with measure). ST_MakePoint while not being OGC compliant is generally faster and more precise than ST_GeomFromText and ST_PointFromText. It is also easier to use if you have raw coordinates rather than WKT.

[Note]

Note x is longitude and y is latitude

[Note]

Use ST_MakePointM if you need to make a point with x,y,m.

This function supports 3d and will not drop the z-index.

Examples

--Return point with unknown SRID
SELECT ST_MakePoint(-71.1043443253471, 42.3150676015829);

--Return point marked as WGS 84 long lat
SELECT ST_SetSRID(ST_MakePoint(-71.1043443253471, 42.3150676015829),4326);

--Return a 3D point (e.g. has altitude)
SELECT ST_MakePoint(1, 2,1.5);

--Get z of point
SELECT ST_Z(ST_MakePoint(1, 2,1.5));
result
-------
1.5

See Also

ST_GeomFromText, ST_PointFromText, ST_SetSRID, ST_MakePointM