[SERVER-8038] $nearSphere on boundaries does not work Created: 27/Dec/12  Updated: 11/Jul/16  Resolved: 14/Jan/13

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

Type: Bug Priority: Major - P3
Reporter: Thomas Rosenblatt Assignee: hari.khalsa@10gen.com
Resolution: Done Votes: 0
Labels: $nearSphere, geo, nh-240
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 64 bits 12.04


Operating System: ALL
Participants:

 Description   

I have a 2d index on "place.location" on my collection.
I would like to know what is my northest object.
To do so I first write this command
nws_rs_1:SECONDARY> db.device.find({"place.location" : {$near : [0,90]})
But since it considers earth as 2 dimentionnal I got wrong results. (only those where longitude is near 0)

Then when I used $nearSphere I always got the result below:
nws_rs_1:SECONDARY> db.device.find({"place.location" : {$nearSphere : [0,90]})
error: {
"$err" : "point (0,-90.6664) must be in earth-like bounds of long : [-180, 180], lat : [-90, 90] ",
"code" : 14808
}

Any idea why this happend ? Otherwise how could I get the northest point in my collection ?

BR,

Thomas.



 Comments   
Comment by hari.khalsa@10gen.com [ 14/Jan/13 ]

Additionally, even if the points were all well formed, there is no wrapping in 2d's near search There is a new index type coming out soon called 2dsphere that will handle wrapping and other spherical geo functionality.

Comment by hari.khalsa@10gen.com [ 14/Jan/13 ]

To use the spherical functions, your data has to be within long: [-180,180] and lat: [-90, 90]. You have data in your index with a latitude that is out of range for the spherical near search.

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