Show
In the following example, I have some stored polygons located over the Baltic sea (between Sweden and Finland). Whenever I draw a polygon over the area where the polygons lie, they are correctly detected, namely all 609 objects are found. (see query and Screenshot_1)
db.geojsons.find({
location: {
$geoIntersects: {
$geometry: {
type: "Polygon",
coordinates: [
[ [17.314453, 61.648162], [17.314453, 64.434892], [26.542969, 64.434892], [26.542969, 61.648162], [17.314453, 61.648162], ],
],
},
},
},
});
However, the strange behavior occurs when submitting a wider query polygon a little bit below (see Screenshot 2 and 3 with the corresponding queries).
db.geojsons.find({
location: {
$geoIntersects: {
$geometry: {
type: "Polygon",
coordinates: [
[ [-4.482422, 61.93895], [46.318359, 61.93895], [46.318359, 58.585436], [-4.482422, 58.585436], [-4.482422, 61.93895], ],
],
},
},
},
});
As well as:
db.geojsons.find({
location: {
$geoIntersects: {
$geometry: {
type: "Polygon",
coordinates: [
[ [-4.482422, 61.93895], [36.318359, 61.93895], [36.318359, 58.585436], [-4.482422, 58.585436], [-4.482422, 61.93895], ],
],
},
},
},
});
Hereby, I also attach three example GeoJSONs that I use:
{
type: "Feature",
location: {
type: "Polygon",
coordinates: [
[
[20.9995991794984, 63.4348461784678],
[20.9995991794984, 63.4240745387888],
[21.0236395339339, 63.4240745387888],
[21.0236395339339, 63.4348461784678],
[20.9995991794984, 63.4348461784678],
],
],
},
properties: { acquisitionDate: ISODate("2017-01-13T09:10:31Z") },
_class: "com.models.database.GeoJson",
};
{
type: "Feature",
location: {
type: "Polygon",
coordinates: [
[
[20.9995993299129, 63.424076492091],
[20.9995993299129, 63.413304836971],
[21.0236306669723, 63.413304836971],
[21.0236306669723, 63.424076492091],
[20.9995993299129, 63.424076492091],
],
],
},
properties: { acquisitionDate: ISODate("2017-01-13T09:10:31Z") },
_class: "com.models.database.GeoJson",
};
{
type: "Feature",
location: {
type: "Polygon",
coordinates: [
[
[20.9995994802004, 63.4133067893598],
[20.9995994802004, 63.4025351187936],
[21.0236218074932, 63.4025351187936],
[21.0236218074932, 63.4133067893598],
[20.9995994802004, 63.4133067893598],
],
],
},
properties: { acquisitionDate: ISODate("2017-01-13T09:10:31Z") },
_class: "com.models.database.GeoJson",
};
Thank you in advance!