[Proj] WGS84 to Sphere Inconsistency Between Proj Versions

Gerald I. Evenden geraldi.evenden at gmail.com
Thu Aug 21 21:18:19 EDT 2008


On Thursday 21 August 2008 7:50:13 pm 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

The projection is not odd, maybe the usage.

> 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

Simpler to use proj:
proj +proj=lcc +R=6371200 +lat_1=50 +lon_0=-107
-8.667 70.933
2859697.41      4597308.07

where the -8.667 is longitude and 70.933 is latitude.

> 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

The problem here is what are the projection parameter being used by matlab?  
What is the "mex" file.  If the matlab is projecting with an elliptical earth 
then the values will be different.  But who know what is going on within 
matlab.

Sorry to not be able to help with the matlab stuff other than to point out 
that you need to know what is going on within that system and how is it 
projecting the data.

> 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
>
>
> the matlab result matches that of the cs2cs command given above.
>
> If anyone has any answers, or even if you want to try to project these
> test coords using your proj install, and send those along, your help
> would be greatly appreciated.
>
>
> Thanks a ton,
> Faron



-- 
The whole religious complexion of the modern world is due
to the absence from Jerusalem of a lunatic asylum.
-- Havelock Ellis (1859-1939) British psychologist


More information about the Proj mailing list