[SERVER-2408] $within $centerSphere not implemented Created: 25/Jan/11  Updated: 25/Jan/11  Resolved: 25/Jan/11

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

Type: Bug Priority: Major - P3
Reporter: Robert Stam Assignee: Greg Studer
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7 64 bit using latest server build downloaded 2011-01-25


Operating System: ALL
Participants:

 Description   

When I run this query using the C# driver:

"{ \"Location\" : { \"$within\" :

{ \"$centerSphere\" : [[-74, 40.74], 1] }

} }"

I get this error:

MongoDB.DriverOnlineTests.MongoCollectionTests.TestFindWithinCircleSphericalTrue:
MongoDB.Driver.MongoQueryException : QueryFailure flag set: Spherical distance would require wrapping, which isn't implemented yet (response:

{ "$err" : "Spherical distance would require wrapping, which isn't implemented yet", "code" : 13462 }

)

Here's the same error reproduced in shell:

> use onlinetests
switched to db onlinetests
> db.testcollection.find()

{ "_id" : ObjectId("4d3f20f0e447ad602837252f"), "Location" : [ -74, 40.74 ], "Na me" : "10gen", "Type" : "Office" } { "_id" : ObjectId("4d3f20f0e447ad6028372530"), "Location" : [ -75, 40.74 ], "Na me" : "Two", "Type" : "Coffee" } { "_id" : ObjectId("4d3f20f0e447ad6028372531"), "Location" : [ -74, 41.73 ], "Na me" : "Three", "Type" : "Coffee" }

> db.testcollection.find({ "Location" : { "$within" :

{ "$centerSphere" : [[-74, 40.74], 1] }

} })
error: {
"$err" : "Spherical distance would require wrapping, which isn't impleme
nted yet",
"code" : 13462
}
>



 Comments   
Comment by Greg Studer [ 25/Jan/11 ]

The $centerSphere query isn't really designed for very large distances (yet), try using a smaller value on the order of hundreds of km (also see http://groups.google.com/group/mongodb-user/browse_thread/thread/b062e3a251f16d7e for another discussion). Note that the distance measure is in radians, where 1 radian given the radius of the earth is > 6000 km

Generated at Thu Feb 08 02:59:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.