Grid shift files.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Grid shift files.

Roger Oberholtzer-2
I am trying to use a grid shift file via the C API.

It works for me in one situation, but not another:

The working one (OSTN02):

                +proj=tmerc
                +lat_0=49
                +lon_0=-2
                +k=0.9996012717
                +x_0=400000
                +y_0=-100000
                +ellps=airy
                +nadgrids=gb.gsb
                +units=m
                +no_defs

The one that is not working (RD New):

                +proj=sterea
                +lat_0=52.15616055555555
                +lon_0=5.38763888888889
                +k=0.9999079
                +x_0=155000
                +y_0=463000
                +ellps=bessel
                +nadgrids=rdtrans2008.gsb
                +units=m
                +no_defs

The grid shift files are in the same directory. The strange thing is that when I trace the program execution (strace on Linux), I see that the OSTN02 file gb.gsb is opened and read. However, the one that is not working (RD New) does not even try to open the rdtrans2008.gsb file. So it is not a matter of the format of the file. It is not even being accessed. (I may later have a file format issue. I hope not.)

I know it's old, but this is with 4.8.0. I cannot think the mechanics of opening the file are different. Could it be related to another parameter I am using in RD New? +proj or +ellps?

--
Roger Oberholtzer

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: Grid shift files.

Sebastiaan Couwenberg
On 2016-11-01 15:54, Roger Oberholtzer wrote:

> I am trying to use a grid shift file via the C API.
>
> It works for me in one situation, but not another:
>
> The working one (OSTN02):
>
> [...]
>
> The one that is not working (RD New):
>
> [...]
>
> The grid shift files are in the same directory. The strange thing is
> that
> when I trace the program execution (strace on Linux), I see that the
> OSTN02
> file gb.gsb is opened and read. However, the one that is not working
> (RD
> New) does not even try to open the rdtrans2008.gsb file. So it is not a
> matter of the format of the file. It is not even being accessed. (I may
> later have a file format issue. I hope not.)
>
> I know it's old, but this is with 4.8.0. I cannot think the mechanics
> of
> opening the file are different. Could it be related to another
> parameter I

Sounds like you're using PROJ.4 4.9.2, and hitting this issue:

  http://lists.maptools.org/pipermail/proj/2016-February/007327.html

Which has been fixed in 4.9.3 with:

  https://github.com/OSGeo/proj.4/pull/349

Kind Regards,

Bas
_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: Grid shift files.

Roger Oberholtzer-2


On Tue, Nov 1, 2016 at 4:06 PM, Bas Couwenberg <[hidden email]> wrote:


Which has been fixed in 4.9.3 with:

  https://github.com/OSGeo/proj.4/pull/349
 

I have updated to 4.9.3 as a test. However, I am still not seeing the grid file even being accessed. It has to at least try to open it, right? I don't even see it try and fail. It simply does not try.


--
Roger Oberholtzer

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: Grid shift files.

Sebastiaan Couwenberg
On 2016-11-02 09:11, Roger Oberholtzer wrote:

> On Tue, Nov 1, 2016 at 4:06 PM, Bas Couwenberg <[hidden email]>
> wrote:
>> Which has been fixed in 4.9.3 with:
>>
>>   https://github.com/OSGeo/proj.4/pull/349
>
> I have updated to 4.9.3 as a test. However, I am still not seeing the
> grid
> file even being accessed. It has to at least try to open it, right? I
> don't
> even see it try and fail. It simply does not try.

Yes, if you enable PROJ.4 debug output (using the PROJ_DEBUG=3
environment variable) your should see pj_open_lib(rdtrans2008.gsb) and
pj_open_lib(naptrans2008.gtx).

 From the debug output I linked in the earlier message out this issue:

  Test:   05 Zuid-Limburg
  Exec:   cs2cs -r +init=epsg:4258 +to +init=rdnap:rdnap -f %.4f
  Input:  50.792584908 5.773795547 174.9478
  STDERR: pj_open_lib(epsg): call fopen(./epsg) - succeeded

  pj_open_lib(rdnap): call fopen(./rdnap) - succeeded

  pj_open_lib(rdtrans2008.gsb): call fopen(./rdtrans2008.gsb) - succeeded

  NTv2 NL_ALL   63x65: LL=(2.5,50.5) UR=(7.66666667,55.8333333)

  NTv2 NL_LAND  561x421: LL=(3,50.5) UR=(7.66666667,54)

  NTv2 - loading grid NL_LAND
  pj_open_lib(rdtrans2008.gsb): call fopen(./rdtrans2008.gsb) - succeeded

  pj_apply_gridshift(): used NL_LAND
  pj_open_lib(naptrans2008.gtx): call fopen(./naptrans2008.gtx) -
succeeded

  GTX 311x641: LL=(2.5,50.5) UR=(7.66666667,55.8333333)
  pj_open_lib(naptrans2008.gtx): call fopen(./naptrans2008.gtx) -
succeeded

  pj_apply_gridshift(): used GTX Vertical Grid Shift File
  Output: 182260.4500 311480.6701 129.0000
  Expect: 182260.4500 311480.6700 129.000
  Test OK: From ETRS89 to RD/NAP - 05 Zuid-Limburg (Not identical, but
within margin)

Kind Regards,

Bas
_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: Grid shift files.

Roger Oberholtzer-2


On Wed, Nov 2, 2016 at 9:41 AM, Bas Couwenberg <[hidden email]> wrote:
On 2016-11-02 09:11, Roger Oberholtzer wrote:
> On Tue, Nov 1, 2016 at 4:06 PM, Bas Couwenberg <[hidden email]>
> wrote:
>> Which has been fixed in 4.9.3 with:
>>
>>   https://github.com/OSGeo/proj.4/pull/349
>
> I have updated to 4.9.3 as a test. However, I am still not seeing the
> grid
> file even being accessed. It has to at least try to open it, right? I
> don't
> even see it try and fail. It simply does not try.

Yes, if you enable PROJ.4 debug output (using the PROJ_DEBUG=3
environment variable) your should see pj_open_lib(rdtrans2008.gsb) and
pj_open_lib(naptrans2008.gtx).

 From the debug output I linked in the earlier message out this issue:

  Test:   05 Zuid-Limburg
  Exec:   cs2cs -r +init=epsg:4258 +to +init=rdnap:rdnap -f %.4f
  Input:  50.792584908 5.773795547 174.9478
  STDERR: pj_open_lib(epsg): call fopen(./epsg) - succeeded

  pj_open_lib(rdnap): call fopen(./rdnap) - succeeded

  pj_open_lib(rdtrans2008.gsb): call fopen(./rdtrans2008.gsb) - succeeded

  NTv2 NL_ALL   63x65: LL=(2.5,50.5) UR=(7.66666667,55.8333333)

  NTv2 NL_LAND  561x421: LL=(3,50.5) UR=(7.66666667,54)

  NTv2 - loading grid NL_LAND
  pj_open_lib(rdtrans2008.gsb): call fopen(./rdtrans2008.gsb) - succeeded

  pj_apply_gridshift(): used NL_LAND
  pj_open_lib(naptrans2008.gtx): call fopen(./naptrans2008.gtx) -
succeeded

  GTX 311x641: LL=(2.5,50.5) UR=(7.66666667,55.8333333)
  pj_open_lib(naptrans2008.gtx): call fopen(./naptrans2008.gtx) -
succeeded

  pj_apply_gridshift(): used GTX Vertical Grid Shift File
  Output: 182260.4500   311480.6701 129.0000
  Expect: 182260.4500   311480.6700 129.000
  Test OK: From ETRS89 to RD/NAP - 05 Zuid-Limburg (Not identical, but
within margin)


I get:

% PROJ_DEBUG=3  cs2cs -r  +to +init=rdnap:rdnap -f %.4f
pj_open_lib(rdnap): call fopen(/opt/rsoft/lib/proj/rdnap) - succeeded

pj_open_lib(proj_def.dat): call fopen(/opt/rsoft/lib/proj/proj_def.dat) - succeeded

50.792584908 5.773795547 174.9478
pj_open_lib(naptrans2008.gtx): call fopen(/opt/rsoft/lib/proj/naptrans2008.gtx) - succeeded

GTX 311x641: LL=(2.5,50.5) UR=(7.66666667,55.8333333)
pj_open_lib(naptrans2008.gtx): call fopen(/opt/rsoft/lib/proj/naptrans2008.gtx) - succeeded

pj_apply_gridshift(): used GTX Vertical Grid Shift File
182225.9086     311388.1617 128.9976



I wonder why I don't get the NTv2 debug statements.

--
Roger Oberholtzer

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: Grid shift files.

Roger Oberholtzer-2


On Wed, Nov 2, 2016 at 11:31 AM, Roger Oberholtzer <[hidden email]> wrote:
 
I wonder why I don't get the NTv2 debug statements.

I cannot seem to get it to open rdtrans2008.gsb. There is no +wgs84 anywhere. It only does the Vertical Grid Shift. rdtrans2008.gsb is in the same place as naptrans2008.gtx

I'm curious why +nadgrids=rdtrans2008.gsb is also listed in the From section. Is that just letting me know it would be used in an inverse calculation?
 
% PROJ_DEBUG=3 cs2cs -v -r  +to +init=rdnap:rdnap

pj_open_lib(rdnap): call fopen(/opt/rsoft/lib/proj/rdnap) - succeeded

pj_open_lib(proj_def.dat): call fopen(/opt/rsoft/lib/proj/proj_def.dat) - succeeded

# ---- From Coordinate System ----
#Lat/long (Geodetic alias)
#
# +proj=latlong +ellps=bessel +nadgrids=rdtrans2008.gsb
# ---- To Coordinate System ----
#Oblique Stereographic Alternative
#       Azimuthal, Sph&Ell
# +init=rdnap:rdnap +proj=sterea +lat_0=52.15616055555555
# +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel
# +nadgrids=rdtrans2008.gsb +geoidgrids=naptrans2008.gtx +units=m +no_defs
50.792584908 5.773795547 174.9478
pj_open_lib(naptrans2008.gtx): call fopen(/opt/rsoft/lib/proj/naptrans2008.gtx) - succeeded

GTX 311x641: LL=(2.5,50.5) UR=(7.66666667,55.8333333)
pj_open_lib(naptrans2008.gtx): call fopen(/opt/rsoft/lib/proj/naptrans2008.gtx) - succeeded

pj_apply_gridshift(): used GTX Vertical Grid Shift File
182225.91       311388.16 129.00


--
Roger Oberholtzer

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: Grid shift files.

Sebastiaan Couwenberg
On 11/02/2016 01:08 PM, Roger Oberholtzer wrote:
> I'm curious why +nadgrids=rdtrans2008.gsb is also listed in the From
> section. Is that just letting me know it would be used in an inverse
> calculation?

Because you didn't initialize the from projection.

Kind Regards,

Bas

--
 GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1
_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj