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

$center on geoquery doesn't return a circle but some kind of square

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.4
    • Affects Version/s: 1.3.4
    • Component/s: Geo
    • None

      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.

            Assignee:
            richard.kreuter Richard Kreuter (Inactive)
            Reporter:
            jvwilge Jeroen van Wilgenburg
            Votes:
            3 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: