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

Mikael Rittri Mikael.Rittri at carmenta.com
Sat May 12 10:16:02 PDT 2012


Hello. 
somerc (Swiss oblique Mercator, invented by Rosenmund) and omerc (Hotine oblique Mercator, invented by Hotine)
are two distinct projection methods using different formulas. Hungary uses a slight generalisation of the Swiss method. 
   According to Oscar van Vlijmen, in a post that should be in the proj list archives somewhere,
the Swiss method can approximate the Hungarian one quite well, with 1 centimeter accuracy I think. 
But when the Hotine method is used for Hungary, the errors can be at least 17 cm, if I remember right. 
I conclude that omerc and somerc probably differs by a couple of decimeters in Switzerland, too. 

Now, there are two complications:
1) A couple of decimeters isn't significant for oil drillers, so EPSG uses omerc (with alpha = 90) for both Switzerland and Hungary.
2) When Gerald Evenden implemented omerc in Proj.4, he didn't implement the case where alpha = 90, which would
require special formulas. 

So you cannot use omerc with alpha = 90 in Proj.4, and there is no reason to do it.
But if one generates projection definitions directly from the EPSG database,
that's what you get for Switzerland and Hungary. 
Apparently, the Proj definitions have been fixed to use somerc, but not the corresponding Esri definitions.

Best regards,

Mikael Rittri
Carmenta
Sweden
http://www.carmenta.com

11 maj 2012 kl. 09:53 skrev "Markus Eberhard" <markus.eberhard at InUnum.li>:

> Am 10.05.2012 21:10, schrieb Markus Eberhard:
>> Am 10.05.2012 16:56, schrieb Frank Warmerdam:
>>> 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.
>>> Markus,
>>> 
>>> 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
>>> opened.
>>> 
>>> eg.
>>> 
>>> 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
>>> out.
>>> 
>>> Best regards,
>> Hi Frank,
>> thanks for your hints. The ESRI projection configuration file is opened
>> successfully on my system:
>> 
>> pj_open_lib(esri): call fopen(/usr/share/proj/esri) - succeeded
>> pj_open_lib(proj_def.dat): call fopen(/usr/share/proj/proj_def.dat) - succeeded
>> 
>> Additionaly I've tried to set the projection config string directly
>> using the following function call:
>> 
>> projPJ projPixel = pj_init_plus( "+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" );
>> 
>> ->  same result: NULL pointer
>> 
>> I'll try to debug the proj library tomorrow - may be you have an
>> additional tip for me?
>> 
>> Thanks
>> Markus
>> 
>> 
>> 
>> _______________________________________________
>> Proj mailing list
>> Proj at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/proj
>> 
> 
> The projection string defined in the ESRI projection configuration file 
> seems to make problems - with the string defined in the ESRI projection 
> config file
> 
> +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
> 
> I get allways a NULL pointer (-> function pj_init_plus).
> 
> http://cs2cs.mygeodata.eu uses the following string for the same 
> projection (CH1903 / LV03 - SRID=21781)
> 
> +proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +x_0=600000 +y_0=200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs
> 
> That projection string leads to a valid projection object. Why there are 
> different projection strings?  http://cs2cs.mygeodata.eu is also based 
> on Proj4!
> 
> Best regards,
> Markus
> 
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj



More information about the Proj mailing list