ArcGIS Server Banner

ST_LineFromShape

ST_LineFromShape

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback
Note: This topic was updated for 9.3.1.

NOTE: Spatial type for PostgreSQL only

Definition

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

Syntax

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 st_linestring, geom2 bytea);

Add records to the lshape table.

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

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

Convert geom1 value to bytea.

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

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

Return the linestrings as text.

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

id 	line

100	LINESTRING ( 850 250, 850 850)
101 LINESTRING ( 33 2, 34 3, 35 6)

See Also

  • An overview of SQL functions used with ST_Geometry types