[postgis-users] Datum Shift Problems with PostGIS

Frank Warmerdam warmerdam at pobox.com
Sun Mar 12 06:44:35 PST 2006


René F. Viancos S. wrote:
> Datum Change from Sad69/utm 19s to wgs84/utm 19s
>  
> # cs2cs +proj=utm +zone=19 +south +ellps=GRS67 +towgs84=-75,-1,-44 
> +unit=m +to +proj=utm +zone=19 +south +datum=WGS84

...

> "select transform(setsrid(the_geom,29179),50000) as the_geom from 
> nombre_tabla"
...
> 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 ?????

René,

The cs2cs command you provide is transforming from SAD69 to WGS84.
The SQL command for PostGIS is going fro WGS84 to SAD69 the way
you have invoked the transform request.  Changing the signs is just
a hack to re-reverse things.  I think if you specified the SAD69
coordinate system properly but invoked the transformation as:

select transform(setsrid(the_geom,50000),29179) as the_geom from
nombre_tabla

then things would work fine.  This basically means "set the SRID of
the input geometry to SAD69" and then "transform the geometry to WGS84".

> 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.

> Second Question: How can we make this inverse transformation with 
> postgis (wgs84 to psad56) ?

In PostGIS reversing the transformation is accomplished by changing
what SRID is set on the input geometry, and what output SRID you have
requested.

Forgive me if I have missed some fine points in your email, I just scanned
it quickly before answering as it seemed no one else had responded yet.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGF, http://osgeo.org




More information about the postgis-users mailing list