Definition
ST_Geometry constructs a geometry from a well-known text representation.
When creating spatial tables that will be used with ArcGIS, it is best to create the column as the geometry supertype (for example, ST_Geometry) rather than specifying an ST_Geometry subtype, such as ST_LineString.
Syntax
Oracle
- For linestrings, polygons, and points
sde.st_geometry (wkt clob, srid integer)
- For optimized points (which do not launch an extproc agent and, therefore, process the query more rapidly)
sde.st_geometry (x, y, z, m, srid)
Use optimized point construction when performing batch inserts of large numbers of point data.
- For parametric circles
sde.st_geometry (x, y, z, m, radius, number_of_points, srid)
- For parametric ellipses
sde.st_geometry (x, y, z, m, semi_major_axis, semi_minor_axis, angle, number_of_points, srid)
- For parametric wedges
sde.st_geometry (x, y, z, m, startangle, endangle, outerradius, innerradius, number_of_points, srid)
PostgreSQL
- For linestrings, polygons, and points
sde.st_geometry (wkt, srid integer) sde.st_geometry (esri_shape bytea, srid integer)
- For parametric circles
sde.st_geometry (x, y, z, m, radius, number_of_points, srid)
- For parametric ellipses
sde.st_geometry (x, y, z, m, semi_major_axis, semi_minor_axis, angle, number_of_points, srid)
- For parametric wedges
sde.st_geometry (x, y, z, m, startangle, endangle, outerradius, innerradius, number_of_points, srid)
SQLite
- For linestrings, polygons, and points
st_geometry (text WKT_string,int32 srid)
- For parametric circles
st_geometry (x, y, z, m, radius, number_of_points, srid)
- For parametric ellipses
st_geometry (x, y, z, m, semi_major_axis, semi_minor_axis, angle_of_rotation, number_of_points, srid)
- For parametric wedges
st_geometry (x, y, z, m, start_angle, end_angle, outer_radius, inner_radius, number_of_points, srid)
Return type
Oracle and PostgreSQL
ST_Geometry
SQLite
Geometryblob
Examples
Creating and querying point, linestring, and polygon features
These examples create a table (geoms) and insert point, linestring, and polygon 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)', 4326)
);
--To insert the same point using optimized point construction:
INSERT INTO GEOMS (id, geometry) VALUES (
1901,
sde.st_geometry (1,2,null,null,4326)
);
INSERT INTO GEOMS (id, geometry) VALUES (
1902,
sde.st_geometry ('linestring (33 2, 34 3, 35 6)', 4326)
);
INSERT INTO GEOMS (id, geometry) VALUES (
1903,
sde.st_geometry ('polygon ((3 3, 4 6, 5 3, 3 3))', 4326)
);
PostgreSQL
CREATE TABLE geoms (
id serial,
geometry sde.st_geometry
);
INSERT INTO geoms (geometry) VALUES (
sde.st_geometry ('point (1 2)', 4326)
);
INSERT INTO geoms (geometry) VALUES (
sde.st_geometry ('linestring (33 2, 34 3, 35 6)', 4326)
);
INSERT INTO geoms (geometry) VALUES (
sde.st_geometry ('polygon ((3 3, 4 6, 5 3, 3 3))', 4326)
);
SQLite
CREATE TABLE geoms (
id integer primary key autoincrement not null
);
SELECT AddGeometryColumn (
NULL,
'geoms',
'geometry',
4326,
'geometry',
'xy',
'null'
);
INSERT INTO geoms (geometry) VALUES (
st_geometry ('point (1 2)', 4326)
);
INSERT INTO geoms (geometry) VALUES (
st_geometry ('linestring (33 2, 34 3, 35 6)', 4326)
);
INSERT INTO geoms (geometry) VALUES (
st_geometry ('polygon ((3 3, 4 6, 5 3, 3 3))', 4326)
);
Creating and querying parametric circles
Create a table, radii, and insert circles into it.
Oracle
CREATE TABLE radii (
id integer,
geometry sde.st_geometry
);
INSERT INTO RADII (id, geometry) VALUES (
1904,
sde.st_geometry (10,10,NULL,NULL,25,50,4326)
);
INSERT INTO RADII (id, geometry) VALUES (
1905,
sde.st_geometry (5,15,NULL,NULL,10,20,4326)
);
PostgreSQL
CREATE TABLE radii (
id serial,
geometry sde.st_geometry
);
INSERT INTO radii (geometry) VALUES (
sde.st_geometry (10,10,NULL,NULL,25,50,4326)
);
INSERT INTO radii (geometry) VALUES (
sde.st_geometry (5,15,NULL,20,10,30,4326)
);
SQLite
CREATE TABLE radii (
id integer primary key autoincrement not null
);
SELECT AddGeometryColumn (
NULL,
'radii',
'geometry',
4326,
'geometry',
'xy',
'null'
);
INSERT INTO radii (geometry) VALUES (
st_geometry (10,10,NULL,NULL,25,50,4326)
);
INSERT INTO radii (geometry) VALUES (
st_geometry (5,15,NULL,20,10,30,4326)
);
Creating and querying parametric ellipses
Create a table, track, and insert ellipses into it.
Oracle
CREATE TABLE track (
id integer,
geometry sde.st_geometry
);
INSERT INTO TRACK (id, geometry) VALUES (
1907,
sde.st_geometry (0,0,NULL,NULL,10,5,0,50,4326)
);
INSERT INTO TRACK (id, geometry) VALUES (
1908,
sde.st_geometry (4,19,10,20,10,5,0,40,4326)
);
PostgreSQL
CREATE TABLE track (
id serial,
geometry sde.st_geometry
);
INSERT INTO track (geometry) VALUES (
sde.st_geometry (0,0,NULL,NULL,10,5,0,50,4326)
);
INSERT INTO track (geometry) VALUES (
sde.st_geometry (4,19,10,20,10,5,0,40,4326)
);
SQLite
CREATE TABLE track (
id integer primary key autoincrement not null
);
SELECT AddGeometryColumn (
NULL,
'track',
'geometry',
4326,
'geometry',
'xy',
'null'
);
INSERT INTO track (geometry) VALUES (
st_geometry (0,0,NULL,NULL,10,5,0,50,4326)
);
INSERT INTO track (geometry) VALUES (
st_geometry (4,19,10,20,10,5,0,40,4326)
);
Creating and querying parametric wedges
Create a table, pwedge, and insert a wedge into it.
Oracle
CREATE TABLE pwedge (
id integer,
label varchar2(8),
shape sde.st_geometry
);
INSERT INTO PWEDGE (id, label, shape) VALUES (
1,
'Wedge1',
sde.st_geometry (10,30,NULL,NULL,45,145,5,2,60,4326)
);
PostgreSQL
CREATE TABLE pwedge (
id serial,
label varchar(8),
shape sde.st_geometry
);
INSERT INTO pwedge (label, shape) VALUES (
'Wedge',
sde.st_geometry(10,30,NULL,NULL,45,145,5,2,60,4326)
);
SQLite
CREATE TABLE pwedge (
id integer primary key autoincrement not null,
label varchar(8)
);
SELECT AddGeometryColumn (
NULL,
'pwedge',
'shape',
4326,
'geometry',
'xy',
'null'
);
INSERT INTO pwedge (label, shape) VALUES (
'Wedge',
st_geometry(10,30,NULL,NULL,45,145,5,2,60,4326)
);