ST_X

更新时间:
复制 MD 格式

Returns the x coordinate of a point geometry object.

Syntax

float ST_X(geometry aPoint)

Parameters

ParameterDescription
aPointThe point object from which to extract the x coordinate.

Usage notes

  • aPoint must be a point object.

  • If aPoint is unavailable or invalid, ST_X returns NULL.

  • ST_X preserves z coordinates when applied to 3D point objects.

Examples

Extract the x coordinate from a 4D point:

SELECT ST_X('POINT(0 1 2 3)'::geometry);

Output:

 st_x
------
    0
(1 row)