bryan-emmanuel / javageomodel

Automatically exported from code.google.com/p/javageomodel
0 stars 0 forks source link

Antimeridean crossing not working quite as expected #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I integrated google maps api with app engine and java geo model.

It is working great, apart from when I cross the antimeridian, the results 
aren't as expected.

This bounding box produces what looks like the wrong cells

GeocellManager.bestBboxSearchCells(new BoundingBox(76.043611, 4.576263, 
-54.505934, 87.076263), null)
 = [4, 6, c, e]

This bounding box looks to produce the correct cells (all of them)

GeocellManager.bestBboxSearchCells(new BoundingBox(76.337307, 87.076263, 
-53.785238, 109.576263), null)
 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f]

Unless I am incorrectly interpreting the bounds that google maps api is 
returning.

Original issue reported on code.google.com by daniel.t...@gmail.com on 13 Apr 2011 at 8:15

GoogleCodeExporter commented 9 years ago
Sorry, typo on that first box

GeocellManager.bestBboxSearchCells(new BoundingBox(76.043611,64.576263, 
-54.505934, 87.076263), null) = [4, 6, c, e]

Original comment by daniel.t...@gmail.com on 13 Apr 2011 at 8:37

GoogleCodeExporter commented 9 years ago
Fixed my side using this 

List<String> cells = null;

Boolean antimeridian=  bounds[1] > bounds[3];

if ( antimeridian )
{           
    cells = GeocellManager.bestBboxSearchCells(new BoundingBox(bounds[2], bounds[3], bounds[0], -180.0), null);

    cells.addAll(GeocellManager.bestBboxSearchCells(new BoundingBox(bounds[2], 180.0, bounds[0], bounds[1]), null));
}
else
{
    BoundingBox bb = new BoundingBox(bounds[2], bounds[3], bounds[0], bounds[1]);
    cells = GeocellManager.bestBboxSearchCells(bb, null);
}

Original comment by daniel.t...@gmail.com on 13 Apr 2011 at 10:38

GoogleCodeExporter commented 9 years ago
Fixed on 0.0.6 version

Original comment by alexandr...@gmail.com on 12 May 2011 at 7:52

GoogleCodeExporter commented 9 years ago

Original comment by alexandr...@gmail.com on 12 May 2011 at 7:52