[Proj] WGS84 to Sphere Inconsistency Between Proj Versions

Hamish hamish_b at yahoo.com
Thu Aug 21 22:21:42 EDT 2008

Faron Anslow  wrote:
> 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.

It's not LCC, but I wonder if similar scripts written for
Smith & Sandwell's bathymetry data could help? (wrt @null usage)

is there any code with the data for interfacing with GMT
mapping? Maybe some clues there.

> 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.

Any thoughts on publishing that as open source?
I'd be interested to see that; currently for working with PROJ.4
from within Matlab we just make a series of system calls to
cs2cs. But it's a bit of a clunky solution. Either like:
 [exitcode, result] = system('cs2cs +parameters < inputfile.txt')

or with !cs2cs as in this script:
(fairly straight forward, just MS Windows needs the environment set; adapted from the FWTools .bat setup file)

I've never used it, but seem to recall reading that Matlab's
mapping toolbox uses PROJ.

> Our question is which result is the correct one?

Getting it working with confidence via cs2cs seems like a good
first approach, i.e. minimize the unknown variables.

> 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.

how about proj 4.5 on that other machine?
IIRC between those releases proj.4 changed the way it dealt with
situations where datum transform params were given on one side
of the "+to" but no the other. Best to specify that on both
sides if you can.

> 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.


> Department of Earth and Ocean Sciences
> The University of British Columbia

good memories of the dept, from many many years ago. (pre-Earth&)



More information about the Proj mailing list