ST_X()

All functions > GEOSPATIAL > ST_X()

Returns the X coordinate of a point (or longitude for geography).

Signatures

X coordinate

Returns: X coordinate (or longitude)

ST_X(point: T) → DOUBLE
sql
ParameterTypeRequiredDescription
pointTYesA Point geometry or geography

With:

  • T : Custom types: GEOM_POINT | GEOG_POINT

Signature notes:

  • Input must be a Point; other sub kinds return NULL
  • On GEOGRAPHY, returns the longitude in degrees (first argument to ST_GEOGPOINT)
  • GEOG_POINT uses X = longitude, Y = latitude; mixing lat/long when calling constructors breaks ST_X / ST_Y results
  • Returns NULL if the input is NULL

Availability

StatusBackends
Not availableclickhouse, mysql

Examples

FeatureQL
RETURN
    -- X of a geometry point
    f1 := ST_X(ST_GEOMPOINT(3.0, 4.0))
;
Result
f1 DECIMAL
3.0