<span style="font-weight: bold;">Datum shift Problems with PostGIS</span><span class="gmail_quote"></span><br><br>Dear List Users, In order to make datum change with proj from command line, i have the following example that works fine.
<br><br>Datum Change from Sad69/utm 19s to wgs84/utm 19s<br> <br># cs2cs +proj=utm +zone=19 +south +ellps=GRS67 <span style="font-weight: bold;">+towgs84=-75,-1,-44</span>  +unit=m +to +proj=utm +zone=19 +south +datum=WGS84 
<br><br>In Order to make the same procces, but using Postgis we have added a record en the spatial_ref_sys table, with a custom epsg code to get a personalized transformation, and in en the proj4text field the following sentence (like the parameters of cs2cs) has been added.
<br><br>Record added to spatial_ref_sys Table
<br><br>srid : <span style="font-weight: bold;">50000</span><br>auth_name : EPSG<br>auth_srid: 50000<br>srtext : Sad69 a wgs84<br>proj4text : +proj=utm +zone=19 +south +ellps=GRS67 <span style="font-weight: bold;">+towgs84=75,1,44
</span>  +unit=m +to +proj=utm +zone=19 +south +datum=WGS84 +no_defs<br>
<br>To run this custom datum transformation we use the transform() function build in a query inserted as parameter in the pgsql2shp command.<br><br>pgsql2shp -h localhost -p 5432 -u pgsql -P pgsql -f shapefile_name.shp db_name 
<br>"select transform(setsrid(the_geom,29179),<span style="font-weight: bold;">50000</span>) as the_geom from nombre_tabla"<br><br>(we have our cartography with SRID=-1, reason why we use the setsrid function)<br>
<br>we get a shapefile correctly transformed to wgs84/utm 19s Datum<br> <br><span style="font-weight: bold;">Here is the first Question: Why we need to change the sign in the transformation parameters, +towgs84=-75,-1,-44 in command line and +towgs84=75,1,44 in the proj4text fiel of the spatial_ref_sys table ?????
<br><br></span>we had many problems with this, we solve it, but we don't know why we need to change it if postgis works with proj.<br><br>Now, we try to make the inverse process, in order to make a datum shift from WGS84 utm 19s to sad69 utm 19s, and the proj documentation tells that the -I parameter is the only that we need to make the inverse datum shift. With cs2cs command the -I parameter works fine, but the inclusion of this parameter in the proj4text field in the spatial_ref_sys table does not make a correct transformation, giving us around 1000 meters of displacement.
<br><br><span style="font-weight: bold;">Second Question: How can we make this inverse transformation with postgis (wgs84 to psad56) ?</span><br><span class="sg"><br clear="all"><br>-- <br>Jaime H. Villanueva A.<br>Ingeniero Geomensor.
<br>Cel: (56-9) 9423810

</span><br clear="all"><br>-- <br>René F. Viáncos S.<br>Director de Geomática y TIC<br>Vicerrectoría de Investigación y Desarrollo<br>Universidad de Chile<br>Tel (56-2) 632 62 09<br>Cel (56 9) 933 72 66<br><a href="mailto:rviancos@uchile.cl">
rviancos@uchile.cl</a><br><a href="mailto:rviancos@gmail.com">rviancos@gmail.com</a><br><a href="http://www.investigacion.uchile.cl">www.investigacion.uchile.cl</a>