diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2018-10-08 15:47:48 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2018-10-08 15:56:30 +0200 |
| commit | f080fc81167f7b091252c24828c288884ffdbfba (patch) | |
| tree | 33875cfbaf7b6dc3fe907ab32de4c2bb94e908f6 /src | |
| parent | cc33c1324b5c815901f056abd8baa49ffb064ccd (diff) | |
| download | PROJ-f080fc81167f7b091252c24828c288884ffdbfba.tar.gz PROJ-f080fc81167f7b091252c24828c288884ffdbfba.zip | |
NTv1 grid shift: fix file offset for reading of shift values in ntv1_can.dat
When investigating the format of NTv1 and comparing PROJ code with the actual
header of ntv1_can.dat, I discovered that the longitude & latitude shift values
started at offset 192, whereas PROJ assumed that the header was 176 bytes only.
This caused PROJ to use the wrong offsets values (shift of one grid sample by
longitude). So the effect was moderately visible, especially on the latitude,
but when comparing with NTv2, one can see that the longitude value after the
fix seems to closer to NTv2.
old:
echo "60.5 -100.5 0" | PROJ_LIB=/usr/share/proj src/cct -d 8 +proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=ntv1_can.dat +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1
60.50022624 -100.50040292 0.00000000 inf
new:
echo "60.5 -100.5 0" | PROJ_LIB=/usr/share/proj src/cct -d 8 +proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=ntv1_can.dat +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1
60.50022403 -100.50041841 0.00000000 inf
echo "60.5 -100.5 0" | PROJ_LIB=/usr/share/proj src/cct -d 8 +proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=$HOME/proj/proj-datumgrid/north-america/ntv2_0.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1
60.50022348 -100.50041978 0.00000000 inf
old:
$ echo "80.1 -70.9 0" | PROJ_LIB=/usr/share/proj src/cct -d 8 +proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=ntv1_can.dat +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1
80.10096789 -70.89746834 0.00000000 inf
new:
$ echo "80.1 -70.9 0" | PROJ_LIB=/usr/share/proj src/cct -d 8 +proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=ntv1_can.dat +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1
80.10096858 -70.89749190 0.00000000 inf
$ echo "80.1 -70.9 0" | PROJ_LIB=/usr/share/proj src/cct -d 8 +proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=$HOME/proj/proj-datumgrid/north-america/ntv2_0.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1
80.10096782 -70.89749276 0.00000000 inf
Diffstat (limited to 'src')
| -rw-r--r-- | src/pj_gridinfo.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pj_gridinfo.c b/src/pj_gridinfo.c index f201f39e..de0e8d31 100644 --- a/src/pj_gridinfo.c +++ b/src/pj_gridinfo.c @@ -660,7 +660,7 @@ static int pj_gridinfo_init_ntv2( projCtx ctx, PAFile fid, PJ_GRIDINFO *gilist ) static int pj_gridinfo_init_ntv1( projCtx ctx, PAFile fid, PJ_GRIDINFO *gi ) { - unsigned char header[176]; + unsigned char header[192]; /* 12 records of 16 bytes */ struct CTABLE *ct; LP ur; @@ -731,7 +731,7 @@ static int pj_gridinfo_init_ntv1( projCtx ctx, PAFile fid, PJ_GRIDINFO *gi ) ct->cvs = NULL; gi->ct = ct; - gi->grid_offset = pj_ctx_ftell( ctx, fid ); + gi->grid_offset = (long) sizeof(header); gi->format = "ntv1"; return 1; |
