[Proj] help me about the pj_init problem

Frank Warmerdam warmerdam at pobox.com
Sat Apr 4 10:00:30 EST 2009

luckmdw at gmail.com wrote:
>  I will also post a section of my program that include the pj_init() function that seems cause the error.
> void EngineCommon::initialize_proj_ref()
> {
>     if(projRef != NULL) release_proj_ref();
>     char* parameters[]={"proj=lcc","ellps=WGS84"};
> //double lat_1=45;
> //double lat_2=60;
>       if(!(projRef = pj_init(2,parameters))){
>      //if(!(projRef = pj_init_plus(*parameters))){
>         printf("Projection Initialization Failure: %d\n%s\n",pj_errno,pj_strerrno(pj_errno));
>       printf("error number:%d\n",pj_errno);
>     }
> }
>     my program can run on the pc succsessfully ,but when i transplantate after compile it together with the proj which utilize the arm cross-compiling toolchian,and then run on the Xscale platform,some information may suggest some error on the terminal,confer to the follow;
>    Projection Initialization Failure: -21                      
>     conic lat_1 = -lat_2                                                            


You have not specified lat_1 or lat_2 values.  I suspect on the PC the
proj_def.dat initialization file is being found which defaults lat_1 to 33
and lat_2 to 45 (good for the continental USA) while on the ARM this file
is not being found and the default of zero and zero is used.  This is
apparently inappropriate for LCC.

Please add appropriate lat_1 and lat_2 values for LCC in your definition. If
you want the same results as on the PC you could explicitly specify:

   char* parameters[]={"proj=lcc","lat_1=33", "lat_2=45", "ellps=WGS84"};

Good luck,
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