-
Type: Question
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Geo
-
None
Collection content:
db.geotest.insert({
"geometry" :
})
The following query does not return anything (the searched shape is totally within the polygon):
db.geotest.find({
"geometry":{"$geoIntersects":{"$geometry":{"type":"Polygon",
"coordinates":[[[10,60],[160,60],[160,20],[10,20],[10,60]]]
}}}});
But when we shrink the polygon just a little (160->150, the shape is still inside), we get the expected result:
db.geotest.find({
"geometry":{"$geoIntersects":{"$geometry":{"type":"Polygon",
"coordinates":[[[10,60],[150,60],[150,20],[10,20],[10,60]]]
}}}});
I chose the values to be round and nice, but this appeared many times for the others and I did not find any pattern. I tested it on 3 different mongodb versions: 3.0.4, 2.6.5 and 2.6.9. I tested also with changing points order and custom crs. This example works with setting crs to "urn:x-mongodb:crs:strictwinding:EPSG:4326", but I can find also other examples that failed.
My case is filtering the polygons of countries borders by the visible area and on large polygons (but much smaller than half of the sphere) couple of countries was always missing in the result.
I have no idea if I do sth wrong or this is a bug.
- is related to
-
SERVER-16557 $geoWithin does not return all documents within polygon
- Closed
-
SERVER-17092 $geoWithin does not return result on certains Polygons
- Closed