UpdateGeometrySRID

Signatures

BOOLEAN UpdateGeometrySRID(VARCHAR tableName, GEOMETRY geom, INTEGER srid);

Description

Updates the srid of all features in a geometry column (geom) from a table (tableName).

Returns TRUE if the srid has been updated.

Warning

UpdateGeometrySRID does not to actually change the projection of geom. For this purpose, use ST_Transform

Examples

Create a table named GEO_POINT and insert a POINT with a SRID equal to 0

CREATE TABLE GEO_POINT (THE_GEOM GEOMETRY(POINT));
INSERT INTO GEO_POINT VALUES('SRID=0;POINT(0 0)');

Check the SRID

SELECT ST_SRID(THE_GEOM) as SRID FROM GEO_POINT;

Answer: SRID = 0

Update the SRID

SELECT UpdateGeometrySRID('GEO_POINT','THE_GEOM',4326);

And check the SRID

SELECT ST_SRID(THE_GEOM) as SRID FROM GEO_POINT;

Answer: SRID = 4326

See also