[postgis-users] Using grids transformation method with PostGis

Luís de Sousa luis.a.de.sousa at gmail.com
Tue Jun 8 09:24:29 PDT 2010


Hello everyone,

I'm trying to convert a series of spatial features from one SRS to
another within PostGIS. Both are local systems for continental
Portugal, for which a set of grid definition files have been made
available by the University of Oporto. I downloaded these grid files
and copied them into /usr/share/proj and /usr/local/share/proj. That
was enough to get proj to start using them.

The problem is, when invoking the same transformation from PostGis I'm
getting errors in the range of tenths, sometimes hundreds, of metres.
It seems like PostGis is failing to use the grid files. In attachment
goes a log demonstrating the same transformation having different
results with proj and PostGis.

What am I missing? Is there any extra configuration needed for PostGis
to use the grid files?

Thank you,

Luís
-------------- next part --------------
$ cat in.txt
-74584.120 2459.620

$ cs2cs +init=pt:dlxhg +to +init=pt:pttm06 < in.txt
-74582.57	2460.86 0.00

$ psql -d pontosDTU -h localhost -p 5432 -U arhtappPassword for user arhtapp: 
psql (8.4.4)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.

pontosDTU=# SELECT PostGIS_Full_Version();
                                  postgis_full_version                                  
----------------------------------------------------------------------------------------
 POSTGIS="1.4.0" GEOS="3.2.2-CAPI-1.6.2" PROJ="Rel. 4.7.1, 23 September 2009" USE_STATS
(1 row)

pontosDTU=# UPDATE spatial_ref_sys
pontosDTU-#    SET proj4text = '+proj=tmerc +lat_0=39.66666666666666 +lon_0=1 +k=1 +x_0=0 +y_0=0 +ellps=intl +pm=lisbon +units=m +no_defs +nadgrids=ptLX_e89.gsb'
pontosDTU-#  WHERE srid = 20791;
UPDATE 1

pontosDTU=# SELECT X(ST_Transform(PointFromText('POINT(-74584.120 2459.620)', 20791), 3763)),
pontosDTU-#        Y(ST_Transform(PointFromText('POINT(-74584.120 2459.620)', 20791), 3763));
         x         |        y         
-------------------+------------------
 -74477.6196590331 | 2281.82581261726
(1 row)


More information about the postgis-users mailing list