[Proj] WGS84 to Sphere Inconsistency Between Proj Versions

Faron Anslow fanslow at eos.ubc.ca
Thu Aug 21 19:50:13 EDT 2008


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

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,

Post Doctoral Researcher
Department of Earth and Ocean Sciences
The University of British Columbia
6339 Stores Road
Vancouver, British Columbia
Canada, V6T 1Z4

604 822 3063 

More information about the Proj mailing list