2

UpdateGeometrySRID actually transforms the coordinate system of my data? For in the PostGIS documentation it appears the trim ST_Transform (Returns a new geometry with its coordinates transformed to the SRID referenced by the integer parameter.). What is the difference between these functions?

Another thing the sql below really redesigns same data? So no need to use UpdateGeometrySRID

ALTER TABLE lotacao ALTER COLUMN geom TYPE geometry (MULTILINESTRING, 101020) USING ST_Transform (ST_SetSRID(geom, 101010), 101020);
3

UpdateGeometrySRID is only changing the SRID in all necessary places taking care of the triggers. Use case is that user has imported data with wrong SRID code and wants to correct it without making a new import. Function does not reproject the data like ST_Transform does and coordinate values will remain the same after UpdateGeometrySRID.

For the second question, you can trust the PostGIS documantation http://postgis.net/docs/UpdateGeometrySRID.html. You can read that UpdateGeometrySRID is only a more handy way to do

ALTER TABLE roads 
  ALTER COLUMN geom TYPE geometry(MULTILINESTRING, 4326) 
    USING ST_SetSRID(geom,4326);

If you look at the SQL with ST_Transform you can see that it also contains that same ST_SetSRID stuff which means that it runs also UpdateGeometrySRID but by using the longer syntax.

0

The "ST_UpdateGeometrySRID" function transfers the the spatial reference system of you data into another coordinate system and then UPDATE the geometry column of the existing table, which means it would change the spatial reference system of your table/geometry column and save it forever.

Yet "ST_Transform" would only return you the new geometry with it's spatial reference system transformed to the coordinate system you specified WITHOUT updating/changing the geometry column of the existing table.

I would suggest using "ST_Transform" whenever it's possible since it won't alter your original data.

I think the query you provided would do pretty much the same as what "ST_UpdateGeometrySRID" can do, the only difference is you called the "ST_SetSRID" function to define a spatial reference system to your geometry column before you transform it to another, seems you are doing it because of the spatial reference system of your geometry column is not defined or defined incorrectly so you need to fix it first.

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.