ST_Entity

NoteNote:

Oracle and SQLite only

Definition

ST_Entity returns the spatial entity type of a geometry object. The spatial entity type is the value stored in the entity member field of the geometry object.

Syntax

Oracle

sde.st_entity (geometry1 sde.st_geometry)

SQLite

st_entity (geometry1 geometryblob)

Return type

A number (Oracle) or integer (SQLite) is returned that represents the following entity types:

0

nil shape

1

point

2

line (includes spaghetti lines)

4

linestring

8

area

257

multipoint

258

multiline (includes spaghetti lines)

260

multilinestring

264

multiarea

Example

The following example creates a table and inserts three types of geometries. Then ST_Entity is run to return the geometry subtype of each record in the table.

Oracle

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

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

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

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

SELECT sde.st_entity (geometry) entity, UPPER (sde.st_geometrytype (geometry)) TYPE
 FROM sample_geos;

    ENTITY        TYPE

    1    ST_POINT
    4    ST_LINESTRING
    8    ST_POLYGON

SQLite

CREATE TABLE sample_geos (
 id integer primary key autoincrement not null
);

SELECT AddGeometryColumn (
 NULL,
 'sample_geos',
 'geometry',
 4326,
 'geometry',
 'xy',
 'null'
);

INSERT INTO sample_geos (geometry) VALUES (
 st_geometry ('point (1 2)', 4326)
);

INSERT INTO sample_geos (geometry) VALUES (
 st_geometry ('linestring (33 2, 34 3, 35 6)', 4326)
);

INSERT INTO sample_geos (geometry) VALUES (
 st_geometry ('polygon ((3 3, 4 6, 5 3, 3 3))', 4326)
);

SELECT st_entity (geometry) AS "entity",
 st_geometrytype (geometry) AS "type"
 FROM sample_geos;

entity    type

1         ST_POINT
4         ST_LINESTRING
8         ST_POLYGON

Related Topics

6/19/2015