[Proj] grid-shift issues

Craig Bruce csbruce at cubewerx.com
Tue Oct 26 16:56:55 EDT 2004

Frank Warmerdam <warmerdam at pobox.com> wrote:

> I understand your problem, but I don't have a solution.  In theory we
> could provide (optional) area of use polygons for each grid file, but
> that would be alot of work and evaluating each point to see which area
> of use polygon it was in would be very expensive for those transforming
> alot of points.

I suppose that is a hairy problem.  We could just get the politicians
together to redefine the border as being 44° all the way across the

> I have attached null.lla.  It is the PROJ CVS tree.  I don't think any of
> the grid shift files are in the PROJ.4 source tarball are they?  It may
> be that the build version of null is also missing from the last grid
> shift file snapshot.  If so, let me know and I will put up a new one.

It is not present in this file, which I presume is the latest:


But, your "null" file also doesn't seem to be selected.  Here is some
output from my program the first time a transformation is called:

before: X=-75.7, Y=45.4
pj_open_lib(ntv2_0.gsb): call fopen(/usr/local/cubewerx/share/proj/ntv2_0.gsb) - succeeded
NTv2 CAeast   529x241: LL=(-88,40) UR=(-44,60)
NTv2 CAwest   649x157: LL=(-142,47) UR=(-88,60)
NTv2 CAnorth  589x181: LL=(-142,60) UR=(-44,75)
NTv2 CAarctic 295x109: LL=(-142,75) UR=(-44,84)
NTv2 ALbanff  11x21: LL=(-115.583333,51.0833333) UR=(-115.5,51.25)
pj_open_lib(ntv1_can.dat): call fopen(/usr/local/cubewerx/share/proj/ntv1_can.dat) - succeeded
NTv1 393x177: LL=(-142,40) UR=(-44,84)
pj_open_lib(alaska): call fopen(/usr/local/cubewerx/share/proj/alaska) - succeeded
Ctable Alaska 529x249: LL=(-194,46) UR=(-127.875,77.125)
pj_open_lib(conus): call fopen(/usr/local/cubewerx/share/proj/conus) - succeeded
Ctable Conterminous United States 273x121: LL=(-131,20) UR=(-62.75,50.25)
pj_open_lib(null): call fopen(/usr/local/cubewerx/share/proj/null) - succeeded
Ctable Null transform for whole world 3x3: LL=(-180,-90) UR=(360,450)
NTv2 - loading grid ONottawa
pj_open_lib(ntv2_0.gsb): call fopen(/usr/local/cubewerx/share/proj/ntv2_0.gsb) - succeeded
pj_apply_gridshift(): used ONottawa
after: err=0, X=-75.70032762502939, Y=45.39994870069643

Note that the "null" Ctable apparently goes to UR=(360,450).

When I try to transform a point outside of the other grid files, I get:

before: X=10, Y=5
pj_open_lib(null): call fopen(/usr/local/cubewerx/share/proj/null) - succeeded
pj_apply_gridshift(): failed to find a grid shift table for
                      location (10.0000000dW,5.0000000dN)
   tried: @ntv2_0.gsb, at ntv1_can.dat, at alaska, at conus, at null
ERROR-00002: PROJ-library error #-38 in pj_transform(): failed to load NAD27-83
             correction file (raised in function CoordSysTransformPoint() of
             file "transform.c" line 184)

This is strange, since it seems to load the "null" file to use but then
says that it failed to find a grid shift table.  (I get the same result
with no '@' in front of "null".)

% cs2cs +proj=latlong +datum=WGS84 +to +proj=latlong +nadgrids=@ntv2_0.gsb, at ntv1_can.dat, at alaska, at conus,null
10 5
*       * -0.000

Dr. Craig S. Bruce        | Ph 819-771-8303 x205 |             CubeWerx Inc.
Senior Software Developer |   Fax 819-771-8388   |  Gatineau, Québec, Canada
csbruce at cubewerx.com      |  http://csbruce.com/ |  http://www.cubewerx.com/
 "If most financial analysts watched a puppy growing for the first month of
  its life, they would conclude that a year later it will be 400-foot-tall
                monster trashing downtown Tokyo." -- unknown

More information about the Proj mailing list