Spatial Database Management

Geometry Editors


This function, as we've already seen, is used to set the SRID of a geometry whose SRID is undefined or defined incorrectly. The statement below would re-set the SRID of the geometries in the states table to 4269:

SELECT ST_SetSRID(geom, 4269) FROM usa.states;

Just as the Define Projection tool in ArcMap only changes metadata and not the coordinate values themselves, ST_SetSRID() also has no effect on coordinate values. Where ST_SetSRID() differs from the Define Projection tool is that it is applied on an individual geometry basis rather than on a table basis. To re-project geometries into different coordinate systems (changing both the data and metadata) use the ST_Transform() function.

We worked with this function in Lesson 3. If ST_SetSRID() is analogous to the Define Projection tool then ST_Transform() is analogous to the Project tool. An important thing to remember about ST_Transform() is that it leaves the underlying geometry unchanged when used in a SELECT query. If you want to store the transformed version of the geometry in a table you should use ST_Transform() in an UPDATE or INSERT query.