ST_Envelope

定义

ST_Envelope 以多边形的形式返回 ST_Geometry 对象的最小边界框。

注注:

此函数符合开放地理空间联盟 (OGC) 简单要素规范,其中规定 ST_Envelope 返回多边形。在处理点几何或者水平线或垂直线的特殊情况下,ST_Envelope 返回围绕最大 x 和 y 坐标以及最小 x 和 y 坐标上下一个单位的这些形状的多边形。

语法

sde.st_envelope (g1 sde.st_geometry)

返回类型

ST_Geometry

示例

envelope_test 表的 geotype 列存储 g1 ST_Geometry 列中所存储的几何子类的名称。

CREATE TABLE envelope_test (geotype varchar(20), g1 sde.st_geometry);

INSERT 语句将每个几何子类插入 envelope_test 表中。

Oracle

INSERT INTO ENVELOPE_TEST VALUES (
'Point',
sde.st_geometry ('point (10.02 20.01)', 0)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Linestring',
sde.st_geometry ('linestring (10.01 20.01, 10.01 30.01, 10.01 40.01)', 0)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Linestring',
sde.st_geometry ('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Polygon',
sde.st_geometry ('polygon ((10.02 20.01, 11.92 35.64, 25.02 34.15, 19.15 33.94, 10.02 20.01))', 0)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Multipoint',
sde.st_geometry ('multipoint (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Multilinestring',
sde.st_geometry ('multilinestring ((10.01 20.01, 20.01 20.01, 30.01 20.01), (30.01 20.01, 40.01 20.01, 50.01 20.01))', 0)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Multilinestring',
sde.st_geometry ('multilinestring ((10.02 20.01, 10.32 23.98, 11.92 25.64), (9.55 23.75, 15.36 30.11))', 0)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Multipolygon',
sde.st_geometry ('multipolygon (((10.02 20.01, 11.92 35.64, 25.02 34.15,
19.15 33.94, 10.02 20.01), (51.71 21.73, 73.36 27.04, 71.52 32.87,
52.43 31.90, 51.71 21.73)))', 0)
);

PostgreSQL

INSERT INTO envelope_test VALUES (
'Point',
sde.st_point ('point (10.02 20.01)', 0)
);

INSERT INTO envelope_test VALUES (
'Linestring',
sde.st_linestring ('linestring (10.01 20.01, 10.01 30.01, 10.01 40.01)', 0)
);

INSERT INTO envelope_test VALUES (
'Linestring',
sde.st_linestring ('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);

INSERT INTO envelope_test VALUES (
'Polygon',
sde.st_polygon ('polygon ((10.02 20.01, 11.92 35.64, 25.02 34.15, 19.15 33.94, 10.02 20.01))', 0)
);

INSERT INTO envelope_test VALUES (
'Multipoint',
sde.st_multipoint ('multipoint (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);

INSERT INTO envelope_test VALUES (
'Multilinestring',
sde.st_multilinestring ('multilinestring ((10.01 20.01, 20.01 20.01, 30.01 20.01), (30.01 20.01, 40.01 20.01, 50.01 20.01))', 0)
);

INSERT INTO envelope_test VALUES (
'Multilinestring',
sde.st_multilinestring ('multilinestring ((10.02 20.01, 10.32 23.98, 11.92 25.64), (9.55 23.75, 15.36 30.11))', 0)
);

INSERT INTO envelope_test VALUES (
'Multipolygon',
sde.st_multipolygon ('multipolygon (((10.02 20.01, 11.92 35.64, 25.02 34.15,
19.15 33.94, 10.02 20.01), (51.71 21.73, 73.36 27.04, 71.52 32.87,
52.43 31.90, 51.71 21.73)))', 0)
);

查询将列出子类名称及其包络矩形。ST_Envelope 函数返回围绕点、线或面的包络矩形。

Oracle

SELECT geotype, sde.st_astext (sde.st_envelope (g1)) Envelope
FROM ENVELOPE_TEST;

GEOTYPE      Envelope
 
 Point            POLYGON (( 9.02000000 19.01000000, 11.02000000 19.01000000, 
11.02000000 21.01000000, 9.02000000 21.01000000, 9.02000000 19.01000000))
 Linestring       POLYGON (( 9.01000000 19.01000000, 11.01000000 19.01000000, 
11.01000000 41.01000000, 9.01000000 41.01000000, 9.01000000 19.01000000))
 Linestring       POLYGON (( 10.02000000 20.01000000, 11.92000000 20.01000000,
11.92000000 25.64000000, 10.02000000 25.64000000, 10.02000000 20.01000000))
 Polygon          POLYGON (( 10.02000000 20.01000000, 25.02000000 20.01000000,
25.02000000 35.64000000, 10.02000000 35.64000000, 10.02000000 20.01000000))
 Multipoint       POLYGON (( 10.02000000 20.01000000, 11.92000000 20.01000000,
11.92000000 25.64000000, 10.02000000 25.64000000, 10.02000000 20.01000000))
 Multilinestring  POLYGON (( 9.01000000 19.01000000, 51.01000000 19.01000000, 
51.01000000 21.01000000, 9.01000000 21.01000000, 9.01000000 19.01000000))
 Multilinestring  POLYGON (( 9.55000000 20.01000000, 15.36000000 20.01000000, 
15.36000000 30.11000000, 9.55000000 30.11000000, 9.55000000 20.01000000))
 Multipolygon     POLYGON (( 10.02000000 20.01000000, 73.36000000 20.01000000,
73.36000000 35.64000000, 10.02000000 35.64000000, 10.02000000 20.01000000)) 

PostgreSQL

SELECT geotype, sde.st_astext (sde.st_envelope (g1)) 
AS Envelope
FROM envelope_test;

geotype     envelope

 Point           | POLYGON (( 9.02000000 19.01000000, 11.02000000 19.01000000, 
11.02000000 21.01000000, 9.02000000 21.01000000, 9.02000000 19.01000000))
 Linestring      | POLYGON (( 9.01000000 19.01000000, 11.01000000 19.01000000, 
11.01000000 41.01000000, 9.01000000 41.01000000, 9.01000000 19.01000000))
 Linestring      | POLYGON (( 10.02000000 20.01000000, 11.92000000 20.01000000,
11.92000000 25.64000000, 10.02000000 25.64000000, 10.02000000 20.01000000))
 Polygon         | POLYGON (( 10.02000000 20.01000000, 25.02000000 20.01000000,
25.02000000 35.64000000, 10.02000000 35.64000000, 10.02000000 20.01000000))
 Multipoint      | POLYGON (( 10.02000000 20.01000000, 11.92000000 20.01000000,
11.92000000 25.64000000, 10.02000000 25.64000000, 10.02000000 20.01000000))
 Multilinestring | POLYGON (( 9.01000000 19.01000000, 51.01000000 19.01000000, 
51.01000000 21.01000000, 9.01000000 21.01000000, 9.01000000 19.01000000))
 Multilinestring | POLYGON (( 9.55000000 20.01000000, 15.36000000 20.01000000, 
15.36000000 30.11000000, 9.55000000 30.11000000, 9.55000000 20.01000000))
 Multipolygon    | POLYGON (( 10.02000000 20.01000000, 73.36000000 20.01000000,
73.36000000 35.64000000, 10.02000000 35.64000000, 10.02000000 20.01000000))

7/10/2012