ST_Point

Name

ST_Point — Creates a Point with X, Y and SRID values.

Synopsis

geometry ST_Point ( float x , float y ) ;

geometry ST_Point ( float x , float y , integer srid=unknown ) ;

Description

Returns a Point with the given X and Y coordinate values. This is the SQL-MM equivalent for ST_MakePoint that takes just X and Y.

[Note]

For geodetic coordinates, X is longitude and Y is latitude

Enhanced: 3.2.0 srid as an extra optional argument was added. Older installs require combining with ST_SetSRID to mark the srid on the geometry.

This method implements the SQL/MM specification.

SQL-MM 3: 6.1.2

Examples: Geometry

SELECT ST_Point( -71.104, 42.315);
SELECT ST_SetSRID(ST_Point( -71.104, 42.315),4326);

New in 3.2.0: With SRID specified

SELECT ST_Point( -71.104, 42.315, 4326);

Examples: Geography

Pre-PostGIS 3.2 syntax

SELECT CAST( ST_SetSRID(ST_Point( -71.104, 42.315), 4326) AS geography);

3.2 and on you can include the srid

SELECT CAST( ST_Point( -71.104, 42.315, 4326) AS geography);

PostgreSQL also provides the :: short-hand for casting

SELECT ST_Point( -71.104, 42.315, 4326)::geography;

If the point coordinates are not in a geodetic coordinate system (such as WGS84), then they must be reprojected before casting to a geography. In this example a point in Pennsylvania State Plane feet (SRID 2273) is projected to WGS84 (SRID 4326).

SELECT ST_Transform(ST_SetSRID( ST_Point( 3637510, 3014852 ), 2273), 4326)::geography;