<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Nov 19, 2012 at 6:14 AM, Krzysztof Czainski <span dir="ltr"><<a href="mailto:1czajnik@gmail.com" target="_blank">1czajnik@gmail.com</a>></span> wrote:<br>

<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Hello,<div><br></div><div>I am trying to convert coordinates XY <-> LongLat. All points are expected to be near a specified point, let's say LongLat(21,52).</div><div><br></div><div><div>Converting LongLat -> XY works for me, but XY -> LongLat throws org.osgeo.proj4j.ConvergenceFailureException. Here are the projection parameters:</div>




<div><br></div><div>final String fromParams = "+proj=stere +ellps=WGS84 +lon_0=21.00000000 +lat_0=52.00000000 +no_defs";</div><div>final String toParams = "+proj=longlat +ellps=WGS84 +no_defs"; </div>



</div>
<div><br></div><div>The attached MyTest.java demonstrates my problem. Running it prints:</div><div><br></div><div><div>.E</div><div>Time: 0,047</div><div>There was 1 error:</div><div>1) test(org.osgeo.proj4j.MyTest)org.osgeo.proj4j.ConvergenceFailureException: Iteration didn't converge</div>




<div><span style="white-space:pre-wrap">  </span>at org.osgeo.proj4j.proj.StereographicAzimuthalProjection.projectInverse(StereographicAzimuthalProjection.java:240)</div><div><span style="white-space:pre-wrap">      </span>at org.osgeo.proj4j.proj.Projection.inverseProjectRadians(Projection.java:308)</div>




<div><span style="white-space:pre-wrap">  </span>at org.osgeo.proj4j.BasicCoordinateTransform.transform(BasicCoordinateTransform.java:119)</div><div><span style="white-space:pre-wrap">        </span>at org.osgeo.proj4j.MyTest.test(MyTest.java:27)</div>




<div><span style="white-space:pre-wrap">  </span>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</div><div><span style="white-space:pre-wrap">   </span>at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)</div>




<div><span style="white-space:pre-wrap">  </span>at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)</div><div><span style="white-space:pre-wrap">       </span>at org.osgeo.proj4j.MyTest.main(MyTest.java:9)</div>




<div><br></div><div>FAILURES!!!</div><div>Tests run: 1,  Failures: 0,  Errors: 1</div><div><br></div></div><div>What am I doing wrong?</div><div><br></div><div>Thanks in advance for any help with this,</div><div>Kris</div>

</div></div></blockquote></div></blockquote><div class="gmail_quote"><br></div>2012/11/19 Martin Davis <span dir="ltr"><<a href="mailto:mtnclimb@gmail.com" target="_blank">mtnclimb@gmail.com</a>></span><br><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hmmm, probably a bug - but I'll have to dig into it to see.</blockquote>

<div class="gmail_quote"><br></div><div class="gmail_quote">Thanks for the reply and for looking into this, Martin ;)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div>Can you try the same conversion in Proj4 to see if it works?</div></blockquote><div><br></div><div>Ok. Please see the attached file my_test.c. It works as expected with proj-4.7.0</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div> And it would be helpful to have the expected output. </div></blockquote><div><br></div><div>MyTest.java contains a TestCase, so the expected output is something like:</div><div><div>.</div><div>Time: 0</div><div>OK (1 test)</div>

<div><br></div></div><div>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 ;-)</div>

<div><br></div><div>Cheers,</div><div>Kris</div></div></div>