[Proj4j] XY -> LongLat proj=stere: org.osgeo.proj4j.ConvergenceFailureException

Krzysztof Czainski 1czajnik at gmail.com
Mon Nov 19 10:13:18 PST 2012


>
> On Mon, Nov 19, 2012 at 6:14 AM, Krzysztof Czainski <1czajnik at gmail.com>wrote:
>
>> Hello,
>>
>> I am trying to convert coordinates XY <-> LongLat. All points are
>> expected to be near a specified point, let's say LongLat(21,52).
>>
>> Converting LongLat -> XY works for me, but XY -> LongLat throws
>> org.osgeo.proj4j.ConvergenceFailureException. Here are the projection
>> parameters:
>>
>> final String fromParams = "+proj=stere +ellps=WGS84 +lon_0=21.00000000
>> +lat_0=52.00000000 +no_defs";
>> final String toParams = "+proj=longlat +ellps=WGS84 +no_defs";
>>
>> The attached MyTest.java demonstrates my problem. Running it prints:
>>
>> .E
>> Time: 0,047
>> There was 1 error:
>> 1)
>> test(org.osgeo.proj4j.MyTest)org.osgeo.proj4j.ConvergenceFailureException:
>> Iteration didn't converge
>>  at
>> org.osgeo.proj4j.proj.StereographicAzimuthalProjection.projectInverse(StereographicAzimuthalProjection.java:240)
>> at
>> org.osgeo.proj4j.proj.Projection.inverseProjectRadians(Projection.java:308)
>>  at
>> org.osgeo.proj4j.BasicCoordinateTransform.transform(BasicCoordinateTransform.java:119)
>> at org.osgeo.proj4j.MyTest.test(MyTest.java:27)
>>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at org.osgeo.proj4j.MyTest.main(MyTest.java:9)
>>
>> FAILURES!!!
>> Tests run: 1,  Failures: 0,  Errors: 1
>>
>> What am I doing wrong?
>>
>> Thanks in advance for any help with this,
>> Kris
>>
>
2012/11/19 Martin Davis <mtnclimb at gmail.com>

> Hmmm, probably a bug - but I'll have to dig into it to see.


Thanks for the reply and for looking into this, Martin ;)


> Can you try the same conversion in Proj4 to see if it works?
>

Ok. Please see the attached file my_test.c. It works as expected with
proj-4.7.0


>  And it would be helpful to have the expected output.
>

MyTest.java contains a TestCase, so the expected output is something like:
.
Time: 0
OK (1 test)

If you mean, the expected output of the conversion, it is lon=21, lat=52.
If the output lon/lat are in radians instead, that's OK too - I don't
really know exactly what to expect ;-)

Cheers,
Kris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj4j/attachments/20121119/5d668ffb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: my_test.c
Type: text/x-csrc
Size: 913 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/proj4j/attachments/20121119/5d668ffb/attachment.c>


More information about the Proj4j mailing list