ST_GeomFromShape

RemarqueRemarque :

ST_Geometry in PostgreSQL only

Definition

ST_GeomFromShape constructs an ST_Geometry object from an ESRI shape.

Syntax

st_geomfromshape (esri_shape bytea, srid integer)

Return type

ST_Geometry

Example

The following example inserts a record into the geoshape table with an ID and two geometry columns.

CREATE TABLE geoshape (id integer, g1 sde.st_geometry, g2 bytea);

The INSERT statements insert the data into the columns of the geoshape table. The SELECT statement at the end ensures data was inserted into the g1 column.

INSERT INTO geoshape (id, g1) VALUES (
1, 
sde.st_geometry ('point (10 10)', 0)
);

INSERT INTO geoshape (id, g1) VALUES (
2,
sde.st_geometry ('linestring (10 10, 20 20, 30 30)', 0)
);

UPDATE geoshape
SET g2 = sde.st_asshape (g1)
WHERE id = 1;

UPDATE geoshape
SET g2 = sde.st_asshape (g1)
WHERE id = 2;

SELECT id, sde.st_astext (sde.st_geomfromshape (g2, 0))
FROM geoshape;

id    st_astext
1	POINT ( 10 10)
2	LINESTRING ( 10 10, 20. 20, 3 30)

3/6/2012