[Proj] Proj4-API - pj_init_plus returns a NULL pointer for my ESRI projection string

Frank Warmerdam warmerdam at pobox.com
Thu May 10 09:56:55 EST 2012

On 12-05-10 12:43 AM, Markus Eberhard wrote:
> Hi *,
> I'm using the Proj4-API. Currently I've problems with the following C++
> API call:
>       projPJ projPixel = pj_init_plus( "+init=esri:21781" );
> The called function returns a NULL pointer.
> Strange, the following similar function call works for me
>      projPJ projPixel = pj_init_plus( "+init=world:CH1903" );
> Thanks for your help.


Did you confirm that 21781 is defined in the esri file?  I imagine it
is as I see:
# CH1903 / LV03
<21781> +proj=omerc +lat_0=46.95240555555556 +lonc=7.439583333333333 +alpha=90 
+k=1 +x_0=600000 +y_0=200000 +ellps=bessel +units=m +no_defs  no_defs <>

in mine.

The next thing I'd do is set the PROJ_DEBUG environment variable to 4 and
try again.  There should be some reporting to stderr about what file is


warmerda at gdal65[10]% cs2cs +init=esri:21781
pj_open_lib(esri): call fopen(/home/warmerda/bld/share/proj/esri) - succeeded

pj_open_lib(proj_def.dat): call 
fopen(/home/warmerda/bld/share/proj/proj_def.dat) - succeeded

If that doesn't give a clue you may need to debug into things to figure it

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://home.gdal.org/warmerda
and watch the world go round - Rush    | Geospatial Software Developer

More information about the Proj mailing list