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

Descrizione

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.

Questo metodo implementa la specifica SQL/MM. SQL-MM 3: 6.1.2

Examples: Geometry

SELECT ST_Point( -71.104, 42.315);

Creating a point with SRID specified:

SELECT ST_Point( -71.104, 42.315, 4326);

Alternative way of specifying SRID:

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

Examples: Geography

Create geography points using the :: cast syntax:

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

Pre-PostGIS 3.2 code, using CAST:

SELECT CAST( ST_SetSRID(ST_Point( -71.104, 42.315), 4326) AS 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_Point( 3637510, 3014852, 2273), 4326)::geography;