I have a table with a geometry column (polygon) in a projected coordinate system in meters. Let's say, I want to shift all the polygons by some constant. For example, every point in all polygons must be shifted by X + 4 and Y - 4. Is there a way to do that using PostGIS?

In QGIS, I can do that by selecting all the polygons and using the Move Feature tool. However, QGIS crashes as the amount of vector features is huge, so I try to complete it in PostgreSQL.


You should use ST_Translate for this intent https://postgis.net/docs/ST_Translate.html

UPDATE your_table
SET your_geom_column_name = ST_Translate(your_geom_column_name, 4, 4);

Be aware 4 are units from your geometry projection. Would be better if meters instead of degrees as 4 degrees something like hundred of kilometres...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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