I have a table where one of the columns is a geometry column the_geom
for polygons with an SRID. I added a new column in the same table with exactly the same geometry data as the_geom
.
This new column has the name the_geom4258
because I want to set its SRID to 4258. What is the procedure to change the geometry's SRID to another coordinate system? Is it enough to apply the following query:
UPDATE table SET the_geom4258=ST_SetSRID(the_geom4258,4258);
A spatial reference identifier (SRID) is a unique identifier associated with a specific coordinate system, tolerance, and resolution.
SRID of 0 doesn't technically exist, it just means no SRID — ie, the default if you forget to set it. Zero is a valid SRID, your PostGIS configurations will set for some default value, that in a fresh installation will be WGS84, srid 4326 .
The ST_Transform function takes a geometry and a spatial reference system identifier as input parameters and transforms the geometry to be represented in the given spatial reference system.
geometry is a fundamental PostGIS spatial data type used to represent a feature in planar (Euclidean) coordinate systems. All spatial operations on geometry use the units of the Spatial Reference System the geometry is in.
You should use the ST_Transform function. Also use the function AddGeometryColumn to create your new column, to ensure all the necessary constraints are also created:
SELECT AddGeometryColumn('table','the_geom4258',4258, 'POLYGON', 2); UPDATE table SET the_geom4258 = ST_Transform(the_geom,4258);
ST_SetSRID just sets the projection identifier, but does not actually transform the geometries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With