[OSRS-PROJ] lib call results differ from exec results

Judd Taylor judd at seas.marine.usf.edu
Tue Jul 15 10:02:06 EDT 2003


Don't forget about the pj_init_plus() interface (or pj_free() for that
matter). You can call it like:

char* parms = "+proj=aea +ellps=clrk66 +lat_1=20.0n +lat_2=60.0n +lon_0=110w
+lat_0=40n";
if (!(P = pj_init_plus(parms) ))
{
    printf("proj init failed\n");
    exit(1);
}

and when you're done:

pj_free(P); // clear out memory

-Judd

----- Original Message -----
From: "Sharon Mingus" <dsmingus at yahoo.com>
To: <osrs-proj at remotesensing.org>
Sent: Tuesday, July 15, 2003 9:43 AM
Subject: Re: [OSRS-PROJ] lib call results differ from exec results


> Ok, I am catching the drift here.  I was unaware of
> the different versions, remotesensing.org & "classic
> proj4" .  Also, I missed a comma in the parms
> declaration.  Thanks for the help.
>
> char *parms[] = {
>     "proj=aea",
>     "ellps=clrk66",
>     "lat_1=20.0n",
>     "lat_2=60.0n" // <-- multi-line literal concat
>     "lon_0=110w",
>     "lat_0=40n"
> };
>
> doh!
>
> --- "Gerald I. Evenden" <gerald.evenden at verizon.net>
> wrote:
> > Just to beat this dead horse some more:
> >
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include "lib_proj.h"
> > int
> > main(int narg, char **argl) {
> > PJ *P;
> > XY out;
> > LP in;
> > char *alist[] = {
> > "proj=aea",
> > "ellps=clrk66",
> > "lat_1=20",
> > "lat_2=60",
> > "lon_0=-110",
> > "lat_0=40"};
> >
> > if (!(P = pj_init(6, alist))) {
> > printf("proj init failed\n");
> > exit(1);
> > }
> > in.lam = atof(argl[1]) * DEG_TO_RAD;
> > in.phi = atof(argl[2]) * DEG_TO_RAD;
> > out = pj_fwd(in, P);
> > printf("%s %s makes %.3f %.3f meters\n",argl[1],
> > argl[2], out.x, out.y);
> > exit(0);
> > }
> >
> > After compiling and executing:
> >
> > ./a.out -110.969 39.7621
> > -110.969 39.7621 makes -78175.382 -27659.274 meters
> >
> > Seems to agree pretty well.
> >
> > On Mon, 2003-07-14 at 20:10, Gerald I. Evenden
> > wrote:
> > > For local execution of the runline:
> > >
> > > echo "-110.969 39.7621"|./lproj +proj=aea
> > +ellps=clrk66 +lat_1=20
> > > +lat_2=60 +lon_0=110w +lat_0=40
> > > -78175.38       -27659.27
> > >
> > > which is a much more reasonable value for a point
> > fairly close
> > > to the projection origin of -110,40.
> > >
> > > One problem is there is a "," (comma) in the input
> > stream.
> > > 'lproj' or 'proj' only understand white-space
> > delimiting.
> > >
> > > As for the scanning of "default" file I must admit
> > it was there
> > > earlier and was always a curse.  Number one
> > question after someone
> > > installed the system was why it failed---most of
> > the time the
> > > default file could not be found.  Some setup
> > failure.
> > >
> > > I got rid of it but it still haunts me.
> > > .
> > --
> > Gerald I. Evenden <gerald.evenden at verizon.net>
> >
> > ----------------------------------------
> > PROJ.4 Discussion List
> > See http://www.remotesensing.org/proj for
> > subscription, unsubscription
> > and other information.
>
>
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> ----------------------------------------
> PROJ.4 Discussion List
> See http://www.remotesensing.org/proj for subscription, unsubscription
> and other information.
>

----------------------------------------
PROJ.4 Discussion List
See http://www.remotesensing.org/proj for subscription, unsubscription
and other information.



More information about the Proj mailing list