[SERVER-47651] $geointersects does not work when polygon bigger than semi-sphere Created: 19/Apr/20  Updated: 23/Apr/20  Resolved: 22/Apr/20

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

Type: Improvement Priority: Major - P3
Reporter: Ohad R Assignee: Carl Champain (Inactive)
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File insert polygon.png     PNG File query statement.png    
Issue Links:
Duplicate
duplicates SERVER-45189 Allow strictwinding property also for... Backlog
Participants:

 Description   

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.



 Comments   
Comment by Ohad R [ 23/Apr/20 ]

thanks. yes, it is very similar. guess I've missed it...

 

Comment by Carl Champain (Inactive) [ 22/Apr/20 ]

Hi ohadr.developer@gmail.com,

I believe this is being worked on in SERVER-45189 so I'm going to close this ticket as a duplicate. Please let me know if this is not the case.

Thank you,
Carl

Comment by Ohad R [ 21/Apr/20 ]

thanks for formatting. I tried to edit after I've posted, but I do not have the option for editing.

Comment by Ohad R [ 19/Apr/20 ]

https://stackoverflow.com/questions/37290249/how-to-use-geointersects-to-check-if-a-point-is-within-a-polygon-in-mongodb/61309551#61309551

Generated at Thu Feb 08 05:14:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.