[Proj] How grids work in PROJ4

Frank Warmerdam warmerdam at pobox.com
Wed Jan 11 19:47:45 EST 2012

On Wed, Jan 11, 2012 at 3:15 PM, Michal Seidl <michal.seidl at gmail.com> wrote:

>>> b) if there is +geoidgrids on the LEFT SIDE PROJ thinks there is orthometric
>>> height on input so firstly it changes H by dh from grid to get ellipsoid
>>> height before 3D transformation
>> Right
> It seems to me as cs2cs (trunk version) works exactly in an opposite
> (unreasonable?) manner. If there is +geoidgrids on the LEFT side I would
> suppose cs2cs SUBTRACTs geoid heigth above ellipsoid from GTX file but
> cs2cs ADDs it.


I have checked.  At a point like -116,39 the egm96_15.gtx file has a
value of approximate -21.  At that location the geoid is around 21
meters above the ellipsoidal height.  So the value in the .gtx file is
the amount (in meters) that should be added to the geoid to get to
the ellipsoidal height.

When the geoidgrid is on the left side (the source coordinate system)
the input height is assumed to be geoidal and the amount in the
gtx is added to get to ellipsoidal height.  When the right side
(destination coordinate system) has a geoidgrids setting the value
read from the gtx is subtracted from the elevation to get back to
geoidal height.

> As I know it is usual there is positive value in geoid data set in case
> geoid is above ellipsoid.

Your statement does not match with my findings.  I expect the opposite.

I will note I am using the same convention (positive vs. negative) as
I encountered with the .gtx files distributed with the VDatum program.

>Also egm96_15.gtx is done like this. Should it
> be inverted in case of proj library?
> Example:
> PROJ_LIB=nad PROJ_DEBUG=ON  src/cs2cs +proj=latlong +ellps=WGS84
> +towgs84=0,0,0 +geoidgrids=egm96_15.gtx +to +proj=latlong +ellps=WGS84
> +towgs84=0,0,0
> 15d 50d 0
> 15dE    50dN 44.690
> PROJ_LIB=nad PROJ_DEBUG=ON  src/cs2cs +proj=latlong +ellps=WGS84
> +towgs84=0,0,0 +to +geoidgrids=egm96_15.gtx +proj=latlong +ellps=WGS84
> +towgs84=0,0,0
> 15d 50d 0
> 15dE    50dN -44.690

I checked in the area of 15E, 50N and the .gtx value was approximately
+45 in the .gtx file.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer

More information about the Proj mailing list