Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

While importing my shapefile data to PostGIS, I did not select the proper Projection.

How do I now change the SRID of the data, without transforming the Coordinates?

share|improve this question

1 Answer

up vote 14 down vote accepted

This is a four stage process:

  1. In the geometry_columns table, update the SRID to the required value.

  2. Drop the contraint on the table, by using the following SQL statement

    ALTER TABLE mytable DROP CONSTRAINT enforce_srid_the_geom;

  3. Update the SRID'd of the geometry by using the following SQL statement

    UPDATE mytable SET the_geom = ST_SetSRID(the_geom, newSRID);

  4. Add the contraint back by using the following SQL statement

    ALTER TABLE mytable

    ADD CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = (newSRID));

Or if you want to get it done in one line, you can use the following function:

 select UpdateGeometrySRID('Schema Name', 'mytable', 'the_geom', newSRID) ;
share|improve this answer
1  
See postgis.org/docs/ST_SetSRID.html for more info and links – BradHards Oct 1 '12 at 9:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.