[SERVER-848] $center on geoquery doesn't return a circle but some kind of square Created: 30/Mar/10  Updated: 12/Jul/16  Resolved: 02/Jul/10

Status: Closed
Project: Core Server
Component/s: Geo
Affects Version/s: 1.3.4
Fix Version/s: 1.5.4

Type: Bug Priority: Major - P3
Reporter: Jeroen van Wilgenburg Assignee: Richard Kreuter (Inactive)
Resolution: Done Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen shot 2010-03-30 at 3.00.22 PM.png     PNG File Screen shot 2010-03-30 at 3.08.01 PM.png    
Participants:

 Description   

The circles in the bound queries are not a circle. I get some kind of square. A small sample to reproduce it:

db.places.save({ "loc" :

{ "x" : 4.9999, "y" : 52 }

})
db.places.save({ "loc" :

{ "x" : 5, "y" : 52 }

})
db.places.save({ "loc" :

{ "x" : 5.0001, "y" : 52 }

})
db.places.save({ "loc" :

{ "x" : 5, "y" : 52.0001 }

})
db.places.save({ "loc" :

{ "x" : 5, "y" : 51.9999 }

})
db.places.save({ "loc" :

{ "x" : 4.9999, "y" : 52.0001 }

})
db.places.save({ "loc" :

{ "x" : 5.0001, "y" : 52.0001 }

})
db.places.save({ "loc" :

{ "x" : 4.9999, "y" : 51.9999 }

})
db.places.save({ "loc" :

{ "x" : 5.0001, "y" : 51.9999 }

})
db.places.ensureIndex(

{ loc : "2d" }

)
radius=0.0001
center=[5,52]
db.places.find({"loc" : {"$within" :

{"$center" : [center, radius]}

}})

the result:
{ "_id" : ObjectId("4bb1f2f088df513435bcb4e1"), "loc" :

{ "x" : 5, "y" : 52 }

}
{ "_id" : ObjectId("4bb1f54383459c40223a8ae7"), "loc" :

{ "x" : 5, "y" : 51.9999 }

}
{ "_id" : ObjectId("4bb1f54583459c40223a8aeb"), "loc" :

{ "x" : 5.0001, "y" : 51.9999 }

}
{ "_id" : ObjectId("4bb1f2e588df513435bcb4e0"), "loc" :

{ "x" : 4.9999, "y" : 52 }

}
{ "_id" : ObjectId("4bb1f30888df513435bcb4e2"), "loc" :

{ "x" : 5.0001, "y" : 52 }

}
{ "_id" : ObjectId("4bb1f54383459c40223a8ae8"), "loc" :

{ "x" : 4.9999, "y" : 52.0001 }

}

As you can see in the screenshot some points in the corners are highlighted and they shouldn't (distance between points is 0.0001)

The second screenshot is the result of a query with radius 0.0002. I expect some kind of circle shape, but I get a square.



 Comments   
Comment by Richard Kreuter (Inactive) [ 02/Jul/10 ]

Seems that 224ca4aecdde61bea54af48acf58c39994a497ca fixed this.

Comment by auto [ 01/Jul/10 ]

Author:

{'login': 'kreuter', 'name': 'Richard Kreuter', 'email': 'richard@10gen.com'}

Message: Do one more box of point checks in GeoCircleBrowse. SERVER-848, SERVER-1238
http://github.com/mongodb/mongo/commit/224ca4aecdde61bea54af48acf58c39994a497ca

Comment by auto [ 08/Jun/10 ]

Author:

{'login': 'kreuter', 'name': 'Richard Kreuter', 'email': 'richard@10gen.com'}

Message: Add an error term for distance comparisons in geo search. Part of SERVER-848, SERVER-1191
http://github.com/mongodb/mongo/commit/93661510e975f9c8a62f315c6a602fecbf50cbfb

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