[Proj] WGS84 to Sphere Inconsistency Between Proj Versions

Frank Warmerdam warmerdam at pobox.com
Thu Aug 21 22:15:54 EDT 2008


Faron Anslow wrote:
> Hello,
> 
> This is my first post to the list, so I hope this hasn't been covered 
> extensively elsewhere (probably has).
> 
> A Colleague and I are working with an atmospheric reanalysis product 
> (NARR) that is on a fairly odd projection.  That projection being 
> lambert conformal conic with a spherical earth with radius of 6371200 
> m.  To assist in projecting site data, DEMs and etc from lat/long WGS84 
> coords to our spherical projection my colleague has written a matlab 
> interface to the proj library.  Our problem arises when we compare 
> reprojected coordinate values from cs2cs or GRASS with the matlab mex 
> file result. For instance, with cs2cs, running:
> 
> cs2cs +proj=latlong +datum=WGS84 +to +proj=lcc +lat_1=50 +lat_2=50 
> +lat_0=50 +lon_0=-107 +a=6371200.0000000000 +es=0.0 +f=0.0 +no_defs -r
> 
> on the coordinates  70.933 -8.667 will yield:
> 2859697.41    4597308.07 0.00
> 
> while our matlab mex file gives:
> 2873633.37    4593659.17 -12148.43

Faron,

In PROJ 4.6.0 and later the cs2cs command (and pj_transform()) will
no longer attempt to apply any datum shift or change of ellipsoid
transformation unless both the source and destination coordinate system
have meaningful datum definitions provided (either +towgs84 or +nadgrids).

> I suspect the problem is that documented in the FAQ, which requires the 
> addition of +nadgrids=@null to the proj command.  However, when I add 
> this to the cs2cs call, the results don't change.  When I add it to the 
> mex call, the mex file crashes (not set up to handle the @null I 
> guess).  Our question is which result is the correct one?  We suspect 
> that a big change in elevation should be expected when switching from 
> the WGS84 ellipsoid to the sphere.  cs2cs from proj 4.4 installed on 
> another machine gives results that agree with our mex file.
> 
> Even stranger is that when we compile the mex file with the line:
> 
> mex Work/Code/Matlab_tools/cs2cs_proj4.c /usr/lib/libproj.a
> 
> instead of:
> 
> mex -l proj /home/fanslow/Work/Code/Matlab_tools/cs2cs_proj4.c

I can only conclude that when you link against the static library
you get one version, while the other link command is using a shared
library and you end up picking up a different version of libproj.so.

It isn't easy to deduce your build configuration, but basically I
believe this comes down to the announced change of behavior between
PROJ 4.5 and PROJ 4.6.

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 Programmer for Rent



More information about the Proj mailing list