[Gdal-dev] OGR, PROJ.4, and handling of Datum

VTP ben at vterrain.org
Wed Apr 16 22:12:30 EDT 2003


I would have sent this to the PROJ mailing list, but it pertains to OGR as
well.

When trying to convert coordinates from NAD27 to WGS84, i found that OGR was
giving me wildly incorrect results.  The first thing i managed to do was to
duplicate the results with the latest PROJ.4:

>cs2cs +proj=utm +zone=17 +datum=WGS84 +to +proj=latlong +datum=WGS84
400000 800000
81d54'20.901"W  7d14'11.633"N 0.000
(Works)

>cs2cs +proj=utm +zone=17 +datum=NAD27 +to +proj=latlong +datum=WGS84
400000 800000
*       * 0.000
(Fails, the only difference is that it attempts a Datum conversion)

This is an island off Panama; quite reasonable i believe to be covered by
NAD27.  Turning on debug information with PROJ, we find:

>cs2cs +proj=utm +zone=17 +datum=NAD27 +to +proj=latlong +datum=WGS84
pj_open_lib(proj_def.dat): call fopen(C:\proj\nad/proj_def.dat) - succeeded
pj_open_lib(proj_def.dat): call fopen(C:\proj\nad/proj_def.dat) - succeeded
400000 800000
pj_open_lib(conus): call fopen(C:\proj\nad/conus) - succeeded
Ctable Conterminous United States 273x121: LL=(-131,20) UR=(-62.75,50.25)
pj_open_lib(alaska): call fopen(C:\proj\nad/alaska) - succeeded
Ctable Alaska 529x249: LL=(-194,46) UR=(-127.875,77.125)
pj_open_lib(ntv2_0.gsb): call fopen(C:\proj\nad/ntv2_0.gsb) - failed
pj_open_lib(ntv1_can.dat): call fopen(C:\proj\nad/ntv1_can.dat) - failed
pj_apply_gridshift(): failed to find a grid shift table for
                      location (-81.9057962dW,7.2370229dN)
   tried: @conus, at alaska, at ntv2_0.gsb, at ntv1_can.dat
*       * 0.000

Question #1: What is this ntv2_0.gsb file?  If PROJ looks for it, why is it
not included with the standard PROJ distribution data?

Now, on to OGR.  When i use OGRCreateCoordinateTransformation() for the same
transformation as above, it cheerfully gives me an
OGRCoordinateTransformation object which proceeds to perform totally bogus
conversions.

Question #2: Since PROJ is clearly failing in this case, shouldn't
OGRCreateCoordinateTransformation fail, i.e. return NULL?  Is this a lack of
error-checking in OGR, PROJ, or both?

Thanks,
Ben





More information about the Gdal-dev mailing list