PostGIS

ST_MakePoint

Prev

7.3. Geometry Constructors

Next

Name

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

Synopsis

+geometry +ST_MakePoint(+`float `+x, float y`)`;

+geometry +ST_MakePoint(+`float `+x, float y, float z`)`;

+geometry +ST_MakePoint(+`float `+x, float y, float z, float m`)`;

Description

Creates a 2D, 3D Z or 4D ZM Point geometry.

Use ST_MakePointM to make points with XYM coordinates.

While not OGC-compliant, ST_MakePoint is faster and more precise than ST_GeomFromText and ST_PointFromText. It is also easier to use for numeric coordinate values.

Note

For geodetic coordinates, X is longitude and Y is latitude

check 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