AritzBi
AritzBi

Reputation: 197

How to transform from SRID 4258 to 4326 in PostGIs

I have a column with polygons with the SRID 4258, I have been trying to transform that column to SRID 4326 but does not transform it correctly.

I have done using this two commands:

SELECT UpdateGeometrySRID('lig','geom',4326);
UPDATE lig SET geom=ST_TRANSFORM(ST_SETSRID(geom, 4258), 4326);

Any clues? I mean it should work!

Thanks in advance!

Upvotes: 3

Views: 7949

Answers (1)

Mike T
Mike T

Reputation: 43672

I'm guessing you are using PostGIS 2.x, where you can directly specify the ALTER TABLE DDL to change the definition of the table and update the column as required by ST_Transform:

ALTER TABLE lig
 ALTER COLUMN geom TYPE geometry(Polygon, 4326)
   USING ST_Transform(ST_SetSRID(geom, 4258), 4326);

If you are still using PostGIS 1.x, follow some of these instructions to modify the geometry type.

Upvotes: 9

Related Questions