lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <yo...@lucidimagination.com>
Subject Re: Fun with Spatial (Haversine formula)
Date Sat, 21 Aug 2010 01:50:34 GMT
Lance, have you figured out what the issue is?
Anyone know if this is a haversine limitation, or a bug?

-Yonik
http://lucenerevolution.org Lucene/Solr Conference, Boston Oct 7-8

On Wed, Aug 18, 2010 at 1:54 AM, Lance Norskog <goksron@gmail.com> wrote:
> The Haversine formula in o.a.s.s.f.d.DistanceUtils.java gives these
> results for a 0.1 degree difference in miles:
>
> equator horizontal 0.1 deg: lat/lon 0.0/0.0     -> 396.32050000000004
> equator vertical   0.1 deg: lat/lon 0.0/0.0     -> 396.32050000000004
> NYC horizontal     0.1 deg: lat/lon -72.0/0.0   -> 383.33093669272654
> NYC vertical       0.1 deg: lat/lon -72.0/0.0   -> 396.32049999997747
> arctic horizontal  0.1 deg: lat/lon 89.0/0.0    -> 202.13129169290906
> arctic vertical    0.1 deg: lat/lon 89.0/0.0    -> 396.32049999997747
> N. Pole horizontal 0.1 deg: lat/lon 89.8/0.0    -> 103.61036292825034
> N. Pole vertical   0.1 deg: lat/lon 89.8/0.0    -> 396.3205000000338
>
> That is, a horizontal shift of 0.1 at the equator, New York City's
> latitude, 1 degree south of the North Pole and almost-almost-almost at
> the North Pole, these are the distances in miles.
> The latitude changes make perfect sense, but one would expect the
> longitudes to shrink as well.
>
> Here is the code, added to DistanceUtils.java. What am I doing wrong?
>
>
>  public static void main(String[] args) {
>          show("equator horizontal 0.1 deg", 0.0, 0.0, 0.0, 0.1);
>          show("equator vertical   0.1 deg", 0.0, 0.0, 0.1, 0.0);
>          show("NYC horizontal     0.1 deg", -72, 0.0, -72, 0.1);
>          show("NYC vertical       0.1 deg", -72, 0, -72.1, 0.0);
>          show("arctic horizontal  0.1 deg", 89.0, 0.0, 89.0, 0.1);
>          show("arctic vertical    0.1 deg", 89.0, 0.0, 89.1, 0.0);
>          show("N. Pole horizontal 0.1 deg", 89.8, 0.0, 89.8, 0.1);
>          show("N. Pole vertical   0.1 deg", 89.8, 0.0, 89.9, 0.0);
>  }
>
>  private static void show(String label, double d, double e, double f,
> double g) {
>          System.out.println(label + ": lat/lon " + d + "/" + e + " \t-> " +
> haversine(d,e,f,g, 3963.205));
>  }
>
> (This is from the Solr trunk.)
>
> --
> Lance Norskog
> goksron@gmail.com
>

Mime
View raw message