[SERVER-75528] $geowithin does not work for some polygons Created: 31/Mar/23  Updated: 05/Apr/23  Resolved: 05/Apr/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Arghya Chandan Das Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

Hi Team trying to run the query to fetch all the geometries within given polygon, it does not work. it works for small size polygon though. Please give some insight.
db.table.find(
           { "GeJsonGeometry._v" :
        {
      $geoWithin: {
         $geometry:

{             type: "Polygon",             coordinates: [                [                  [ -180, -46.6038995 ], [ 180, -46.6038995 ], [ 180, 78.7886584 ], [ -180, 78.7886584 ], [ -180, -46.6038995 ]                ]              ]          }

      }
   }
}
          
)



 Comments   
Comment by Chris Kelly [ 05/Apr/23 ]

Glad to hear it! I'll close this ticket.

Comment by Arghya Chandan Das [ 05/Apr/23 ]

Thanks Chris, I wan able to overcome the issue after adding the 

crs:

{                 type: "name",                 properties: \{ name: "urn:x-mongodb:crs:strictwinding:EPSG:4326" }

             
          }

tag as my polygon was crossing two hemisphere.

Comment by Chris Kelly [ 04/Apr/23 ]

Thanks for your report arghya.das@accionlabs.com,

Can you provide additional information? Specifically I am interested in what examples work and don't work. Can you please create a clearer test that demonstrates your issue with initialized data?

It sounds like you may be hitting the issue here https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/#degenerate-geometry but I can't ascertain from the information provided.

Christopher

Generated at Thu Feb 08 06:30:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.