Aggregation Pipeline in MONGOBB COMPASS longitude/latitude is out of bounds (http://geojson.io)

I am watching the video Hackathon APAC & EMEA Session - GDELT Data - Geofencing & Creating notifications MongoDB

in it they went to http://geojson.io to create a JSON with the coordinates of Scotland to use in an Aggregation Pipeline in MONGOBB COMPASS.

I created a Polygon with the Spain and Portugal countries.

When I create the $match Stage in MONGOBB COMPASS an error message is shows saying:

longitude/latitude is out of bounds, lng: -716.638 lat: 42.391

I also tried create a polygon of Scotland, but the coordinates that I get are very different to what they get in the video.

I get values around -720 and they get values between -1 and -6 for a similar region.

What is wrong in http://geojson.io?

Thanks

In MongoDB a GeoJSON point is recorded in Lat/Long order. Your polygons are correct you just need to reverse the coordinates in in GeoJSON point for MongoDB.

Hi @Manuel_Martin,

I’m afraid I have no idea why geojson.io is giving you those numbers! I’ve just created a similar polygon and got the following numbers:

"geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              3.8891601562499996,
              42.47209690919285
            ],
            [
              -3.0322265625,
              43.691707903073805
            ],
            [
              -10.70068359375,
              44.37098696297173
            ],
            [
              -10.56884765625,
              35.871246850027966
            ],
            [
              -1.1865234375,
              36.13787471840729
            ],
            [
              4.81201171875,
              39.842286020743394
            ],
            [
              3.8891601562499996,
              42.47209690919285
            ]
          ]
        ]
      }

Hope this helps!

Mark

1 Like

In MongoDB GeoJSON points are Longitude then latitude, same as in geojson.io - so the pairs are in the correct order.

The problem here is that -720 isn’t a valid longitude or latitude value - it’s just nonsense.

  • Valid longitude values are between -180 and 180 , both inclusive.
  • Valid latitude values are between -90 and 90 , both inclusive.
2 Likes

Thank you very much , I appreciate it

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.