2

after making a clean install with the latest stable release of postgis (2.0) i can't perform any transformations:

SELECT ST_Transform(ST_SetSRID('BOX3D(2644033.2454124987 4580030.29781942,2645409.1119216317 4581406.1643285528)'::box3d,3785), 4326)

The above raises the error:

 NOTICE:  PostGIS was unable to transform the point because either no grid shift files were found, or the point does not lie within the range for which the grid shift is defined. Refer to the ST_Transform() section of the PostGIS manual for details on how to configure PostGIS to alter this behaviour.


 ERROR:  transform: couldn't project point (2.64403e+006 4.58003e+006 0): failed to load NAD27-83 correction file (-38)


 ********** Error **********

 ERROR: transform: couldn't project point (2.64403e+006 4.58003e+006 0): failed to load NAD27-83 correction file (-38)
 SQL state: XX000

Tried the other suggestions of copying proj in contrib folder, restarting pg service with no luck.

Any ideas?

UPDATE: Something really weird is going on here. When executing the statement right after a PG restart it works! Any following statements after that fail!

-- Executing query: SELECT ST_AsText(ST_Transform(ST_GeomFromText('POINT(2649262.94974021 4579345.79221865)', 3785), 4326)) Total query runtime: 20 ms. 1 row retrieved.

-- Executing query: SELECT ST_AsText(ST_Transform(ST_GeomFromText('POINT(2649262.94974021 4579345.79221865)', 3785), 4326)) NOTICE: PostGIS was unable to transform the point because either no grid shift files were found, or the point does not lie within the range for which the grid shift is defined. Refer to the ST_Transform() section of the PostGIS manual for details on how to configure PostGIS to alter this behaviour.

ERROR: transform: couldn't project point (2.64926e+006 4.57935e+006 0): failed to load NAD27-83 correction file (-38)

*** Error ***

George

1 Answer 1

1

You need to set your GDAL_DATA environment variable to access the grid shift files. There are many different ways to modify your system's environment variables, so I can't really explain how to do this.

A suggested place to have GDAL_DATA is C:\Program Files\PostgreSQL\9.1\gdal-data.

2
  • Sorry no luck. Set the system variable... still no luck. Interestingly from 4326 to 3785 works. The other way around it fails.
    – George
    Commented Apr 19, 2012 at 14:47
  • I had exactly the same issue on an (older) Linux server. Finally I had to reinstall (and upgrade) Proj.4 and PostGIS to solve the problem.
    – webrian
    Commented Jun 25, 2013 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.