Name

ST_X — Returns the x coordinate of a point

Synopsis

double ST_X(bytea Geometry);

Alias

X

Description

Returns the x coordinate of a point. Input geometry must be a point, otherwise throws an error.

Coordinate Dimensions
2D3DM
Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006))SQL-MM Part 3
2.1.3.17.2.11.17.2.9.26.1.3

Examples

SELECT ST_X(ST_GeomFromEWKT('POINT(2.5 0 0 -8)'));
--Result
2.5

SELECT ST_X(ST_GeomFromText('POINT(4 0)'));
--Result
4.0

Related functions

ST_Y,ST_Z,ST_M