[SERVER-4027] Accept geo points equal to 180 (or specified max) Created: 06/Oct/11  Updated: 11/Jul/16  Resolved: 01/Jun/12

Status: Closed
Project: Core Server
Component/s: Geo
Affects Version/s: None
Fix Version/s: 2.1.2

Type: Bug Priority: Minor - P4
Reporter: karl seguin Assignee: Mathias Stearn
Resolution: Done Votes: 6
Labels: 212push
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

n/a


Issue Links:
Depends
Related
related to SERVER-1760 Support geo searches across the anti-... Closed
is related to SERVER-6921 jstests/geo_borders.js has several is... Backlog
Backwards Compatibility: Minor Change
Operating System: ALL
Participants:

 Description   

The default geospatial index is -180,180...with the upper bound being exclusive.

However, there are a number of locations in the world which seem to reside at 180° 0′ 0″, like:
http://toolserver.org/~geohack/geohack.php?pagename=Glomar_Challenger_Basin&params=77_45_S_180_0_E_

I've seen two popular geo-ip databases fail to easily import into mongodb because of this.



 Comments   
Comment by Mathias Stearn [ 01/Jun/12 ]

Backward breaking if a user depended on lat=180 points being rejected (probably no-one).

Comment by auto [ 01/Jun/12 ]

Author:

{u'login': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: Support geo indexing with points equal to max (+180 by default) SERVER-4027
Branch: master
https://github.com/mongodb/mongo/commit/86b5b89c2785f3f45ad2674f48fe3189c137904c

Comment by Greg Studer [ 25/Jan/12 ]

The geohash calculation will floor the value of 180 to 0 in the hash, which could lead to that doc being hard to retrieve when the exact document value needs to be tested (near $within/$maxDistance bounds). Better handling of wrapped cases would definitely be helpful here though.

Comment by Jon Hoffman [ 24/Jan/12 ]

we patched the code to get around this problem:

diff --git a/db/geo/2d.cpp b/db/geo/2d.cpp
index 40df5e2..a7348a6 100644
--- a/db/geo/2d.cpp
+++ b/db/geo/2d.cpp
@@ -342,7 +342,7 @@ namespace mongo {
         }
 
         unsigned _convert( double in ) const {
-            uassert( 13027 , str::stream() << "point not in interval of [ " << _min << ", " << _max << " )", in < _max && in >= _min );
+            uassert( 13027 , str::stream() << "point not in interval of [ " << _min << ", " << _max << " ]", in <= _max && in >= _min );
             in -= _min;
             assert( in >= 0 );
             return (unsigned)(in * _scaling);

Generated at Thu Feb 08 03:04:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.