Reputation: 137
I have a question about distance measuring in a $maxDistance. I have document:
{
"location": {
{ "type" : "Point", "coordinates" : [ 38.8993487, -77.0145665 ] }
}
}
Making a query in a shell:
db.places.find({"location": {"$nearSphere": {"$geometry": {"type":"Point", "coordinates": [38.888684, -77.0047189]}, "$maxDistance": 1129 } }})[0].location
Returns a
{ "type" : "Point", "coordinates" : [ 38.8993487, -77.0145665 ] }
But distance measurement made by gpsvisualizer.com shows me 1.4600 km. Mongo have a result with maxDistance set to 1129 meters
So my question is - what did I miss ?:D
Upvotes: 0
Views: 160
Reputation: 2030
I think you missing the fact that mongoDB’s 2d spherical index operators only recognize [longitude, latitude] ordering. Correct link would be: gpsvisualiser. As you can see, distance between those points is about 1,13km :)
Upvotes: 1