ArcGIS Server Banner

ST_Geometry

ST_Geometry

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

Definition

ST_Geometry constructs a geometry from a well-known text representation.

Syntax

Oracle

sde.st_geometry (wkt clob, srid integer)

PostgreSQL

st_geometry (wkt, srid integer)
st_geometry (esri_shape bytea, srid integer)

Return type

ST_Geometry

Example

Create a table, geoms, and insert values into it.

Oracle

CREATE TABLE geoms (id integer, geometry sde.st_geometry);

INSERT INTO geoms (id, geometry) VALUES (
1901,
sde.st_geometry ('point (1 2)', 0)
);

INSERT INTO geoms (id, geometry) VALUES (
1902,
sde.st_geometry ('linestring (33 2, 34 3, 35 6)', 0)
);

INSERT INTO geoms (id, geometry) VALUES (
1903,
sde.st_geometry ('polygon ((3 3, 4 6, 5 3, 3 3))', 0)
);

PostgreSQL

CREATE TABLE geoms (id integer, geometry st_geometry);

INSERT INTO geoms (id, geometry) VALUES (
1901,
st_geometry ('point (1 2)', 0)
);

INSERT INTO geoms (id, geometry) VALUES (
1902,
st_geometry ('linestring (33 2, 34 3, 35 6)', 0)
);

INSERT INTO geoms (id, geometry) VALUES (
1903,
st_geometry ('polygon ((3 3, 4 6, 5 3, 3 3))', 0)
);

Select the geometry from the geoms table.

Oracle

SELECT id, sde.st_astext (geometry) geometry
FROM geoms;

ID          GEOMETRY

1901 POINT (1.00000000 2.00000000) 

1902 LINESTRING (33.00000000 2.00000000, 34.00000000 3.00000000, 35.00000000 6.00000000)

1903 POLYGON ((3.00000000 3.00000001, 5.00000000 3.00000000, 4.00000000 6.00000000, 3.00000000 3.00000000))

PostgreSQL

SELECT id, st_astext (geometry) AS geometry
FROM geoms;

 id        geometry

1901 POINT (1 2) 

1902 LINESTRING (33 2, 34 3, 35 6)

1903 POLYGON ((3 3, 5 3, 4 6, 3 3))

See Also

  • An overview of SQL functions used with ST_Geometry types