Numbers for geoNear maxDistance and DistanceFrom looks not real - please explain

Hi , I am running query against db.nycFacilities and using geo coordinates of NYU as Point coordinates(near: {type: “Point”, coordinates: [40.724663768, -73.990329372]},). I am getting value for DistanceFromNYU = 15074317.5382826 for community park in boro Queens
If coordinates are in meters it is equal ~15k kilometers?
What is wrong?

@Jacob_32894, please edit your post and attach it to the right Topic; you’ll get more responses.
And also include some more details around which Chapter and Quiz/Lecture/Lab etc.

From your example, I’m guessing that you’re expecting a distance of at least 25km?

So I’ll point out a few things:

  • The Point coordinates in $near or $geoNear must be specified in Long/Lat as per doc. You have specified it in Lat/Long.
  • The coordinates in the nycFacilities collection is stored as Long/Lat
  • Google Maps uses Lat/Long which I think is what is causing the confusion

Here’s the query and screenshot that might help:

  near: {
     type: "Point", 
     coordinates: [-73.990329372, 40.724663768]
  distanceField: "distance", 
  distanceMultiplier: 0.001, // convert m to km
  minDistance: 25000, // min distance of 25km
  spherical: true

1 Like