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

$geoWithin does not return result on certains Polygons

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Geo
    • None
    • Fully Compatible
    • ALL
    • Hide

      1. Create dummy collection

      test.js
      db['mongo-test'].insert({
          "city" : "Paris",
          "geom" : {
              "type" : "Point",
              "coordinates" : [ 
                  2.3522219, 
                  48.856614
              ]
          }
      });
      

      2. Create 2dsphere index

      test.js
      db['mongo-test'].ensureIndex({ geom : '2dsphere'});
      

      3. Request with a non-working Polygon !

      test.js
      db['mongo-test'].find({"geom":{"$geoWithin":{"$geometry":{"type":"Polygon","coordinates":[[[-97.20703125,15.623036831528264],[-97.20703125,67.20403234340081],[105.46875,67.20403234340081],[105.46875,15.623036831528264],[-97.20703125,15.623036831528264]]]}}}})
      

      No result is return

      The lat/lng of the record is Paris, and France is entirely in the given Polygon (see attachment)

      Show
      1. Create dummy collection test.js db[ 'mongo-test' ].insert({ "city" : "Paris" , "geom" : { "type" : "Point" , "coordinates" : [ 2.3522219, 48.856614 ] } }); 2. Create 2dsphere index test.js db[ 'mongo-test' ].ensureIndex({ geom : '2dsphere' }); 3. Request with a non-working Polygon ! test.js db[ 'mongo-test' ].find({ "geom" :{ "$geoWithin" :{ "$geometry" :{ "type" : "Polygon" , "coordinates" :[[[-97.20703125,15.623036831528264],[-97.20703125,67.20403234340081],[105.46875,67.20403234340081],[105.46875,15.623036831528264],[-97.20703125,15.623036831528264]]]}}}}) No result is return The lat/lng of the record is Paris, and France is entirely in the given Polygon (see attachment)

      Dear,

      I encounter a special comportment with the $geoWithin command. with certains $box or $geometry, the request does not return any result.

      I try with small polygon and zoom out to bigger (bigger always contains smaller), at a certain range, with exactly the same request, no more result appears !

      Maybe i missed something.

      Best Regards,

      Michael.

        1. polygon view on sphere.png
          polygon view on sphere.png
          379 kB
        2. polygon-view.jpg
          polygon-view.jpg
          43 kB

            Assignee:
            siyuan.zhou@mongodb.com Siyuan Zhou
            Reporter:
            Micatom Michael THOMAS [X]
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: