ST_Point
Name
ST_Point — Creates a Point with the given coordinate values. Alias for ST_MakePoint.
Synopsis
geometry
ST_Point
(
float
x
, float
y
)
;
geometry
ST_Point
(
float
x
, float
y
, integer
srid=unknown
)
;
Description
Returns an Point with the given X and Y coordinate values. This is the SQL-MM alias for ST_MakePoint that takes just X and Y.
For geodetic coordinates,
|
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. Creates a Point with X, Y and SRID values.
This method implements the SQL/MM specification. SQL-MM 3: 6.1.2
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;
See Also
Section 4.3, “Geography Data Type” , ST_MakePoint , ST_SetSRID , ST_Transform , ST_PointZ , ST_PointM , ST_PointZM