haversine() is broken / misdocumented
-------------------------------------

                 Key: LUCENE-3599
                 URL: https://issues.apache.org/jira/browse/LUCENE-3599
             Project: Lucene - Java
          Issue Type: Bug
          Components: modules/spatial
    Affects Versions: 3.5
            Reporter: David Smiley


DistanceUtils.haversine() is coded in a way that is erroneous based on the 
documented order of the parameters.  The parameters are defined as 
(x1,y1,x2,y2,radius)  -- i.e. lon,lat order.  The code implementing the 
algorithm, however, is as if the meaning of x and y are transposed, which means 
that if you supply the arguments in lat,lon (y,x) order, you will get the 
correct behavior.  It turns out that all callers of this method do this!

FYI I found out about this bug since it is inherited code in LSP 
(lucene-spatial-playground) and I have been supplying parameters according to 
its documented order.  Apparently I shouldn't do that ;-)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to