ST_GeomCollFromShape

注注:

仅适用于 PostgreSQL 的 ST_Geometry

定义

ST_GeomCollFromShape 通过 Esri shape 构造几何集合。

语法

sde.st_geomcollfromshape (esri_shape bytea, srid integer)

返回类型

ST_GeomCollection

示例

创建表 gcollection。

CREATE TABLE gcollection (pkey integer, shape sde.st_geomcollection );

在 gcollection 表中插入值。

INSERT INTO gcollection VALUES
(1,
sde.st_geomcollfromshape (sde.st_asshape(sde.st_geomcollection
('multipoint(20 20, 30 30, 20 40,30 50)', 0))::bytea, 0));

INSERT INTO gcollection VALUES 
(2,
sde.st_geomcollfromshape (sde.st_asshape(sde.st_geomcollection
('multilinestring ((10.02 20.01, 10.32 23.98, 11.92 25.64),
(9.55 23.75, 15.36 30.11), (10 10, 20 20, 30 30, 40 40, 90 90))', 0))::bytea, 0));

INSERT INTO gcollection VALUES 
(3,
sde.st_geomcollfromshape (sde.st_asshape(sde.st_geomcollection
('multipolygon(((0 0, 4 0, 4 4, 0 4, 0 0),(1 1, 2 1, 2 2, 1 2, 1 1)), 
((-1 -1, -1 -2, -2 -2, -2 -1, -1 -1)))', 0))::bytea, 0));

从 gcollection 表中选择几何。

SELECT pkey, sde.st_astext(shape) 
FROM gcollection;

 pkey   st_astext

1  	MULTIPOINT ( 20 20, 30 30, 20 40, 30 50) 
	
2  	MULTILINESTRING (( 10.02000000 20.01000000, 10.32000000 23.98000000, 
		11.92000000 25.64000000),( 9.55000000 23.75000000, 
		15.36000000 30.11000000), ( 10 10, 20 20, 30 30, 40 40, 90 90))

3  	MULTIPOLYGON ((( 0 0, 4 0, 4 4, 0 4, 0 0)( 1 1, 1 2, 2 2,
2 1, 1 1)), (( -1 -1, -2 -1, -2 -2, -1 -2, -1 -1))

(3 rows)
9/15/2013