Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-3599

haversine() is broken / misdocumented

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.5
    • 3.6, 4.0-ALPHA
    • modules/spatial
    • None
    • New, Patch Available

    Description

      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

      Attachments

        Activity

          People

            dsmiley David Smiley
            dsmiley David Smiley
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: