Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-2341

Geospacial calculations are off

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.7.4
    • Component/s: Geo
    • None
    • ALL

      Here are my tests:

      // Radius of the earth: 3959.8728
      // Distance to Maplewood, NJ (in radians): 0.0036998565637149016
      // Distance to Maplewood, NJ (in miles 0.0036998565637149016 * 3959.8728): 14.65

      // Does not return Maplewood
      db.example.find( { loc: { $nearSphere: [ -73.99171, 40.738868 ], $maxDistance: 0.0036998565637149016 }});

      // To get a list of all places (with distance in radians):
      db.runCommand(

      { geoNear : "example" , near : [-73.99171,40.738868], spherical: true }

      );

      // This should include Maplewood, does not.
      db.runCommand(

      { geoNear : "example" , near : [-73.99171,40.738868], maxDistance : 0.0036998565637149016, spherical: true }

      );

      Venues:

      geoDoc =

      {"name" : '10gen Office', loc: [ -73.99171, 40.738868 ] }

      db.example.insert(geoDoc);

      geoDoc =

      {"name" : 'Maplewood, NJ', loc: [ -74.2713, 40.73137 ] }

      db.example.insert(geoDoc);

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            rn@deftlabs.com Ryan Nitz
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: