[Proj] Custom nadgrid and .lla format again

nicolas david ericnico.david at gmail.com
Mon Apr 21 04:54:35 EST 2014

Hi Michal

After looking at the source code of proj4 what I'm conclude is (and without
100% certainty)  :

1) difference on lla file are on micro_sec. Because on nad2bin.c the input
read from lla file are converted from micro_sec to radian. see ligne 137
of nad2bin.c :
    "t.lam = (laml += lam) * U_SEC_TO_RAD;"

2) concerning the lla format and after reading the part "Reading the ASCII
Table" of nad2bin.c I'm agreed with your conclusion about <ddx> (  as
before it is was I understand from lignes 132-140 of nad2bin.c)

3) The nadgrid file should be on Local LatLong. If you look at
pj_transform.c when there is/are nadgrids files: for the conversion from
local (source) latlong to wgs84 latlong there is a call to
   pj_apply_gridshift_2( srcdefn, 0, point_count, point_offset, x, y, z );
and from wgs84 to destination (local lat/Long) there is a call to
  pj_apply_gridshift_2( dstdefn, 1, point_count, point_offset, x, y, z );
the second parameter is "inverse" so the first call use the direct way and
the second call the inverse way.

4) the "inverse" is computed with iteration (do while loop) , you could see
that from the nad_cvt.c file.

5) for geoidgrids the inverse is only a "minus" operation because the input
and output coordinate are on the same planimetric system. **The question**
is what is this planimetric system. see some discussion on lastools list (

Hope that could help you.

Nicolas David

2014-04-20 21:15 GMT+02:00 Michal Seidl <michal.seidl at gmail.com>:

> Hello,
> 1) I spent some time testing and studying proj code and this is my
> conclusion about *.lla format that is used by nad2bin
> The data are organized:
> <line number>: <dx> <dy> <ddx> <ddy> .....
> <ddx> means difference between current dx and dx at previous
> position(left).
> So to get dx at some position needs get dx from begging of line plus sum of
> ddx.
> Can someone confirm or explain?
> 2) As I am playing with nadgrids another question rise up. There is just
> one
> nadgrids file. In what coordinate system it should be? In WGS84 LatLong or
> Local LatLong? If you go from local system to WGS84 how can you interpolate
> in gird tha is in WGS84 system?
>    a) some iteration or other clever algorithm
>    b) do not care, correction should not change so dramatically
> Probably the same question applies to geoidgrids?
> Best regards Michal
> --
> View this message in context:
> http://osgeo-org.1560.x6.nabble.com/Custom-nadgrid-and-lla-format-again-tp5135986p5136140.html
> Sent from the PROJ.4 mailing list archive at Nabble.com.
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/proj/attachments/20140421/6a7e6484/attachment.htm 

More information about the Proj mailing list