ST_Entity

注注:

仅 Oracle 和 SQLite

定义

ST_Entity 返回几何对象的空间实体类型。空间实体类型是存储在几何对象的实体成员字段中的值。

语法

Oracle

sde.st_entity (geometry1 sde.st_geometry)

SQLite

st_entity (geometry1 geometryblob)

返回类型

将返回数字 (Oracle) 或整数 (SQLite) 来表示以下实体类型:

0

nil 形状

1

point

2

线(包括 spaghetti 线)

4

线串

8

area

257

多点

258

多线(包括 spaghetti 线)

260

多线串

264

多区域

示例

以下示例将创建表并在其中插入三种几何类型。随即 ST_Entity 运行并返回表中各记录的几何子类型。

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

相关主题

5/25/2014