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

$geointersects does not work when polygon bigger than semi-sphere

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.3.6
    • Component/s: Geo
    • None

      i enter a single entry to mongo, with Polygon which contains most of the earth:

      db.test.insert(
      { loc : { 
          type : "Polygon" ,
          coordinates : [ [[-179, -90],[180, -90],[180, 90],[-179, 90],[-179, -90]]]
          }
      })
      

       

      then, when i query for a Point to get the Polygon(s) who contains it:

      db.getCollection('test').find({
      loc: {
      $geoIntersects: {
      $geometry: {
      type: "Point" ,
      coordinates: [0,0]
      }}}})
      

      i do not get any result. this is because mongo searches in the small part and not in the big one. if i query for a Point which is in the small section, i do get the result:

      db.getCollection('test').find({
      loc: {
      $geoIntersects: {
      $geometry: {
      type: "Point" ,
      coordinates: [-179.5,0]
      }}}})
      

       

      CRS can help me ONLY if i query for a Polygon. but in my case, I query for a Point.

       

      I suggest to support CRS upon insertions of Polygons.

        1. insert polygon.png
          insert polygon.png
          11 kB
        2. query statement.png
          query statement.png
          15 kB

            Assignee:
            carl.champain@mongodb.com Carl Champain (Inactive)
            Reporter:
            ohadr.developer@gmail.com Ohad R
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: