ST_LineFromShape

注注:

仅 PostgreSQL

定义

ST_LineFromShape 采用 Esri shape 和空间参考 ID,并返回 ST_LineString。

语法

sde.st_linefromshape (esri_shape bytea, srid integer)

返回类型

ST_LineString

示例

创建具有两个几何列的 lshape 表(一个是 st_linestring,另一个是 bytea)以及唯一的 ID。

CREATE TABLE lshape (id integer unique, geom1 sde.st_linestring, geom2 bytea);

将记录添加到 lshape 表中。

INSERT INTO lshape (id, geom1) VALUES (
100,
sde.st_linestring ('linestring (850 250, 850 850)', 0)
);

INSERT INTO lshape (id, geom1) VALUES (
101,
sde.st_linestring ('linestring (33 2, 34 3, 35 6)', 0)
);

将 geom1 值转换为 bytea。

UPDATE lshape
SET geom2 = sde.st_asshape (geom1)
WHERE id = 100;

UPDATE lshape
SET geom2 = sde.st_asshape (geom1)
WHERE id = 101;

将线串作为文本返回。

SELECT id, st_astext (sde.st_linefromshape (geom2)) 
AS LINE
FROM lshape;

id 	line

100	LINESTRING ( 850 250, 850 850)
101 LINESTRING ( 33 2, 34 3, 35 6)
5/25/2014