[Proj] Problem in calling pj_transform with retutn x and y = nan

Eric Miller EMiller at dfg.ca.gov
Mon Nov 19 12:16:37 EST 2007


Check the errors pj_get_errno_ref() && pj_strerrno().  I'm guessing the library couldn't find the CONUS nadgrid file.

You should probably be including "proj_api.h" rather than "projects.h" unless you're extending the library...

>>> On 11/19/2007 at 6:52 AM, Limei Ran <lran at unc.edu> wrote:
> Hi:
> 
> Could someone help me on solving the problem I have in calling 
> pj_transform?  I am calling pj_transform to do the projection from our 
> GIS software in C.  I obtained PROJ.4 and datum shift grids files.  I 
> installed the software on our linux server and tested the software using 
> cs2cs.  It works fine with the right output. 
> 
> I compiled our software with the built PROJ.4 library using the lines in 
> our Makefile:
> ==============================
> #set PROJ.4 libary
> PROJDIR=/nas/uncch/depts/cep/emc/lran/soft/proj-4.5.0/exe/lib
> PROJ_H=/nas/uncch/depts/cep/emc/lran/soft/proj-4.5.0/src/projects.h
> 
> # Library paths
> LIBPATH=-L. -L$(PROJDIR)
> LIBS = $(LIBPATH) -lspatial -lm -lproj -static
> .......
> allocator.exe: $(ALLOC)
>         $(CC) -o $@ $(ALLOC) $(LIBS)
> ........
> =================================
> 
> Our program is compiled without errors with PROJ.4 software. 
> In my calling scripts, I set:
> setenv PROJ_LIB /nas/uncch/depts/cep/emc/lran/soft/proj-4.5.0/exe/share/proj
> 
> The program gives the right projected x and y when from and to 
> projections are different, but the datum systems are the same (both 
> NAD27, NAD83, ot sphere).  But, if I give different datum for from and 
> to projections, the print out of projected x and y = nan.  Here are the 
> output lines:
> ==========================================================================
> Input projection:
> PROJ args=+proj=lcc+datum=NAD27+lat_1=33+lat_2=45+lat_0=40+lon_0=-97
> 
> 
> Output projection:
> PROJ 
> args=+proj=lcc+datum=NAD83+lat_1=30.000000+lat_2=60.000000+lon_0=-100.000000+
> lat_0=40.000000+units=m
> 
> 
> In Projection: x=1100.000 y=-11200.000    Out: x=nan y=nan
> In Projection: x=-25000.000 y=25000.000  Out: x=nan y=nan
> ===========================================================================
> 
> Basically, the data transformation parts did not give me the right 
> result even though the program ran without any error.  There are many 
> libary files under ./proj/lib directory.  I am wondering whether LIBS in 
> my Makefile is correct.  Or, I need to set PROJ_LIB somewhere else.  I 
> appreciate any help you might have.
> 
> Thanks,
> 
> LR
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org 
> http://lists.maptools.org/mailman/listinfo/proj




More information about the Proj mailing list