I created a function in PostgreSQL to transform input coordinates using UTM Zone 12/13, with Datums NAD83 or NAD27, to the WYLAM projection. I had to manually create the entry for the proj4text column for WYLAM, because it is missing from SpatialReference.org. The function works just fine when transforming from UTM Zone 13 NAD83 (EPSG: 3743) to WYLAM, for example, but if I try to transform from UTM Zone 13 NAD27 (EPSG: 26713) to WYLAM, the resulting point is about 50m east and 4m north of where it should be. This is what I would expect for a NAD27/NAD83 conflict in my area (Wyoming). I get the same type of error with input coordinates for other UTM zones and for unprojected decimal degrees when using the NAD27 datum and going to WYLAM with NAD83 datum.

I defined the proj4text column as:

+proj=lcc +lat_1=41 +lat_2=45 +lat_0=41 +lon_0=-107.5 +k_0=1 +x_0=500000 +y_0=200000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs

QGIS seems to perform a conversion from UTM Zone 12N NAD27 to WYLAM (NAD83) just fine, and as far as I can tell, all the parameters it has for the two projections are the same as what I'm using in PostgreSQL.

I reviewed this question, and the associated answers and links, but it's not clear to me that this provides any useful information for my problem.

I have also tried converting from UTM Zone 13N NAD83 to UTM Zone 13N NAD27, and going both directions (NAD83 to NAD27) with unprojected (decimal degrees) data, and wind up with the same error. It seems like PostGIS is missing the nadgrid/nadcon information needed to transform between datums accurately.

What am I missing?


OK, with some help from EvenR in the PostGIS chat, I discovered that I was actually missing the NAD-grids that PostGIS uses to convert between datums.

The tip-off was that we were missing the /usr/share/proj directory, and the contents, which are the files that help with this conversion. The directory should have been installed by default by PostGIS, but either wasn't installed, or somehow got deleted later.

If you find that you're missing the proj directory, you can get what you need with:

sudo yum install proj-nad.x86_64

I also installed another package:

sudo yum install proj-epsg.x86_64

But, I'm not sure this was necessary. THe first one seems to include what is necessary for datum transformations.

Once I installed these libraries, and restarted PostgreSQL, conversions between datums with ST_Transform started to work correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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