ArcGIS Server Banner

ST_PointFromShape

ST_PointFromShape

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_PointFromShape takes an ESRI point shape and a spatial reference ID and returns a point.

Syntax

st_pointfromshape (esri_shape bytea, srid integer)

Return type

ST_Point

Example

In this example, the points are stored in the geometry column of the pts table, and the shape column is updated with their shape representations (using the ST_AsShape function). Finally, the ST_PointFromShape function is used to return the points from the shape column. The pts table has a geometry column, where the points are stored, and a shape column, where the points' shape representations are stored.

CREATE TABLE pts (id integer, geometry st_point, shape bytea);

INSERT INTO pts (id, geometry) VALUES (
10,
st_point ('point (44 14)', 0)
);

INSERT INTO pts (id, geometry) VALUES (
11,
st_point ('point (24 13)', 0)
);

UPDATE pts
SET shape = st_asshape (geometry)
WHERE id = 10;

UPDATE pts
SET shape = st_asshape (geometry)
WHERE id = 11;

In the following SELECT statement, the ST_PointFromShape function is used to retrieve the points from the shape column.


SELECT id, st_astext (st_pointfromshape(shape, 0)) AS points
FROM pts;

id	points

10	POINT (44 14)
11	POINT (24 13)

See Also

  • An overview of SQL functions used with ST_Geometry types