I have a geometry column stored as text e.g.:
'010100002091080000000000804D624041000000C066735741'
in PostgreSQL db with PostGIS. This for a point geometry with the EPSG:2193.
How do I convert this text column to a geometry column?
I have seen this question which is essentially the same, but the answer does not work.
Answer
Simply:
ALTER TABLE opr_records ALTER COLUMN geom TYPE Geometry USING geom::Geometry;
Or this if you're using a specific geometry (the post you linked to was using point) and SRID (4326 here):
ALTER TABLE opr_records ALTER COLUMN geom TYPE Geometry(POINT, 4326) USING ST_SetSRID(geom::Geometry,4326);
No comments:
Post a Comment