ArcGIS Server Banner

ST_X

ST_X

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback
Note: This topic was updated for 9.3.1.

Definition

ST_X can take an ST_Point as an input parameter and return its x-coordinate.

Syntax

Oracle

sde.st_x (pt1 sde.st_point)

PostgreSQL

st_x (pt1 st_point)

Return type

Double precision

Example

The x_test table is created with two columns: the gid column, which uniquely identifies the row, and the pt1 point column.

Oracle

CREATE TABLE x_test (gid integer unique, pt1 sde.st_point);

PostgreSQL

CREATE TABLE x_test (gid integer unique, pt1 st_point);

The INSERT statements insert two rows. One is a point without a z-coordinate or measure. The other column has both a z-coordinate and measure.

Oracle

INSERT INTO x_test VALUES (
1,
sde.st_pointfromtext ('point (10.02 20.01)', 0)
);

INSERT INTO x_test VALUES (
2,
sde.st_pointfromtext ('point zm(10.02 20.01 5 7)', 0)
);

PostgreSQL

INSERT INTO x_test VALUES (
1,
st_point ('point (10.02 20.01)', 0)
);

INSERT INTO x_test VALUES (
2,
st_point ('point zm(10.02 20.01 5 7)', 0)
);

The query lists the gid column and the double-precision x-coordinate of the points.

Oracle

SELECT gid, sde.st_x (pt1) "The X coordinate"
FROM x_test;

       GID       The X coordinate

         1            10.02
         2            10.02

PostgreSQL

SELECT gid, st_x (pt1) AS "The X coordinate"
FROM x_test;

       gid       The X coordinate

         1            10.02
         2            10.02

See Also

  • An overview of SQL functions used with ST_Geometry types