1

This question already has an answer here:

I have exported osm data using osm2pgrouting in the database, it has SRID 4326. I want to change projection of all the tables created to a particular SRID in UTM. I read the post FIrst and Second, but these are only changing SRID withour transforming the coordinates. I am using the command

select UpdateGeometrySRID('Schema Name', 'mytable', 'the_geom', newSRID) ;

marked as duplicate by user30184, PolyGeo Jul 23 '16 at 23:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

The function used in UpdateGeometrySRID is st_setsrid instead of st_transform.

st_setsrid just sets the srid value without changing the coordinates. Since there is no function for looping tables to transform projection in PostGIS according to updateGeometrySRID function. I suggest you to write a script in python to execute it:
Firstly execute to get the table names: SELECT table_name FROM information_schema.tables WHERE table_schema='Schema Name' And then, for each table_name, you can execute: ALTER TABLE mytable ALTER COLUMN geom TYPE geometry USING ST_Transform(geom,newsrid);

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