ST_X

Definition

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

Syntax

sde.st_x (pt1 sde.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.

CREATE TABLE x_test (gid integer unique, pt1 sde.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,
sde.st_point ('point (10.02 20.01)', 0)
);

INSERT INTO x_test VALUES (
2,
sde.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, sde.st_x (pt1) 
AS "The X coordinate"
FROM x_test;

       gid       The X coordinate

         1            10.02
         2            10.02
6/19/2015