ST_LineFromShape

HinweisHinweis:

ST_Geometry for PostgreSQL only

Definition

ST_LineFromShape takes an ESRI shape and a spatial reference ID and returns an ST_LineString.

Syntax

sde.st_linefromshape (esri_shape bytea, srid integer)

Return type

ST_LineString

Example

Create the lshape table with two geometry columns—one an st_linestring, the other a bytea—and a unique ID.

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

Add records to the lshape table.

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)
);

Convert geom1 value to bytea.

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

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

Return the linestrings as text.

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)

3/6/2012