So I'm getting some user drawn polygons in WKT with OpenLayers. (Web Mercator CRS) and I now need to now convert it to SRID4326 so can do some spatial queries. However, when it fails to do a ST_Transform. A simplified query I run that gives me the error:

       ST_Transform('SRID=3857;POLYGON((-10179308.152034 5209576.5082574,-10140172.393558 4329021.9425348,-8516038.4167805 4329021.9425348,-9514000.2579329 5385687.421402,-10179308.152034 5209576.5082574))'::geometry,4326)

It gives me this error:

ERROR: transform: couldn't project point (-1.08446e+07 5.1652e+06 0): failed to load NAD27-83 correction file (-38)

HINT: 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. cohere=> select postgis_full_version();

Even after a bit of google-foo, I still can't figure out how to install the correction file I can do And I can do other transformations just fine (I tried 4326 to 2026 and 3857). I read somewhere to check to make sure PROJ is installed and it is:

SELECT PostGIS_Full_Version();

POSTGIS="1.5.2" GEOS="3.2.2-CAPI-1.6.2" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.6.26" USE_STATS


  • What operating system is it on? POSIX (Unix, MacOS X, etc.) or MS Windows? Do you know if you installed PROJ.4 yourself, or from packages?
    – Mike T
    Commented Aug 18, 2011 at 7:01
  • @Mike Its on a RedHat 5.6 box. Now that you mention it, I don't remember explicitly installing Proj4 myself. It must have come from one of the many GIS tools I installed doing project research and maybe didn't come with the grid files I require.
    – Nate
    Commented Aug 18, 2011 at 15:22

4 Answers 4


I had similar problem and this helped me http://www.mail-archive.com/[email protected]/msg12634.html

Copying the directory \share\contrib\postgis\proj from the zip to program files (C:\Program Files\PostgreSQL\9.1alpha1\share\contrib\postgis\proj ) and restarting postgres helped.

(but on Ubuntu)

  • What do you mean by "restarting postgres"?
    – Antonin
    Commented May 8, 2012 at 8:06
  • I meant stopping and starting again postgresql server Commented May 8, 2012 at 17:35

SELECT ST_AsEWKT(st_setsrid(ST_Transform(ST_Transform(ST_SetSRID(ST_Point(-633510.090428,7506727.67383),900913),4269),4326),4326));

  • 2
    Welcome to GIS SE! Could you add a little explanation to your answer?
    – R.K.
    Commented Nov 16, 2012 at 1:35

If you build PROJ.4 from source, make sure to read the instructions, since you need to download the source AND the grid shift files separately. Furthermore, the grid shift files need to be unzipped in the correct directory before ./configure && make && make install. They can't be installed after.

If you install PostgreSQL/PostGIS/GEOS/PROJ.4 from YUM packages, I highly recommend getting all of these from http://www.pgrpms.org/ since they are always current and up-to-date. To get started, I wrote a guide for this on the postgres wiki. With pgrmps.org, you should be able to find/install proj-nad, which is the grid shift data files (and it could already be automatically selected as a dependency, but I'm not sure). Similarly, Ubuntu has a proj-data apt package, which may (or not) be automatically selected as a dependency.


HINT: yum install proj-epsg proj-nad

Then restart postgresql

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.