ArcGIS Server Banner

ST_GeomFromShape

ST_GeomFromShape

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_GeomFromShape constructs a geometry 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 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, 
st_geometry ('point (10 10)', 0)
);

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

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

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

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

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

See Also

  • An overview of SQL functions used with ST_Geometry types