[Proj] Re: Quick question

Eric Miller EMiller at dfg.ca.gov
Tue Nov 30 12:16:10 EST 2004

The proj command line utility does not do datum transformations.  To
emulate the results of the proj command line utility, you have to use
the pj_fwd and pj_inv functions.  Compare the results of the proj and
cs2cs command line programs.  I've cc'ed the proj list in case anyone
there has more to add on the subject.  I'm guessing you do want the
behavior of pj_fwd and not of pj_transform in this case, so for the

// "unsafe" code
IntPtr prj = Proj.pj_init_plus("+init=esri:2163");
ProjUV lp;
lp.u = -100 * Proj.DEG_TO_RAD;
lp.v = 45 * Proj.DEG_TO_RAD;
ProjUV xy = pj_fwd(lp, prj);  

P.S. I don't know why you'd rewrite the wrapper in VB.NET (the whole
point of the CLR is you don't have to rewrite...).

Eric G. Miller
GIS Analyst
Wildlife and Habitat Data Analysis Branch
Department of Fish and Game

>>> "Norman, Mark" <Mark.Norman at parsons.com> 11/30/2004 3:46:14 AM >>>
Mr. Miller (Eric if you prefer),
    I've been reading all I can about Proj.4 and have seen your name
throughout the available literature (if you can call forum postings
literature). I've downloaded the .NET wrapper you wrote in C# and
rewritten it in VB.NET. Everything seems to work fine (other than the
functions noted as not working in your version), however, I am stumped
trying to duplicate the functionality of the command line proj.exe. I
attempting to convert a lat/long coordinate pair to National Atlas
(Lambert Azimuth Equal Area). Using  C:> proj +init=esri:2163    from
the command line I get the correct output. but using:
---------------------------------Start of
Dim src as New Projection("+init=esri:4326")
Dim dst as New Projection("+init=esri:2163")
For your reference:
# US National Atlas Equal Area
<2163> +proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +a=6370997
+b=6370997 +units=m +no_defs no_defs <>

# WGS 84
<4326> +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs no_defs <>

---------------------------------End of

I get different results. They are similar enough that I think the
wrapper is working as it should, but different enough not to output
acceptable results (I've seen differences as large as 20,000 meters). 
So I guess my question is: is there any way to duplicate the results
from the command line Proj.exe using Projection.Transform ?
Thank you for your time and the time you put in creating the .NET
Mark Norman

More information about the Proj mailing list