Index: contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java =================================================================== --- contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java (revision 800954) +++ contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java (working copy) @@ -146,8 +146,8 @@ public void testRange() throws IOException, InvalidGeoException { searcher = new IndexSearcher(directory); - final double[] milesToTest = new double[] {6.0, 0.5, 0.001, 0.0}; - final int[] expected = new int[] {7, 1, 0, 0}; + final double[] milesToTest = new double[] {6000.0, 6.0, 0.5, 0.001, 0.0}; + final int[] expected = new int[] {17, 7, 1, 0, 0}; for(int x=0;x lastDistance); + assertTrue(geo_distance >= lastDistance); lastDistance = geo_distance; } } @@ -237,8 +237,8 @@ public void testGeoHashRange() throws IOException, InvalidGeoException { searcher = new IndexSearcher(directory); - final double[] milesToTest = new double[] {6.0, 0.5, 0.001, 0.0}; - final int[] expected = new int[] {7, 1, 0, 0}; + final double[] milesToTest = new double[] {6000.0, 6.0, 0.5, 0.001, 0.0}; + final int[] expected = new int[] {17, 7, 1, 0, 0}; for(int x=0;x 90.0) { + lat = 90.0 - (lat - 90.0); + } else if (lat < -90.0) { + lat = -90.0 - (lat + 90.0); + } + return lat; + } + + /** + * Returns a normalized Lng rectangle shape for the bounding box + */ + private static double normLng(double lng) { + if (lng > 180.0) { + lng = -1.0*(180.0 - (lng - 180.0)); + } else if (lng < -180.0) { + lng = (lng + 180.0)+180.0; + } + return lng; + } }