[Proj] Use of prj_fwd() function...

Frank Warmerdam warmerdam at pobox.com
Tue Nov 9 13:26:22 EST 2004


David.Jacques at CCRS.NRCan.gc.ca wrote:
>       char lon[40];
>       char lat[40];
> 
> 	//get the destination projection info
> 	if (! (ref = pj_init((sizeof(parms)/sizeof(char*)),parms)))
> 	{
> 		fprintf(stderr, "Projection initialization failed\n");
> 		exit(1);
> 	}	
> 
> 	//project the input coordinates
> 	dddata.u = -70.8669968;
> 	dddata.v =  46.3959999;
> 	lccdata = pj_fwd(dddata,ref);
>        printf("%lf,%lf\n",dddata.u,dddata.v);

David,

pj_fwd() takes the latitude and longitude in radians.  You need to adjust
accordingly.

eg.

dddata.u = -70.8669968 * DEG_2_RAD;
dddata.v =  46.3959999 * DEG_2_RAD;

Other than that I think you have things right.


Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Proj mailing list