Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-34673

Create Index does not support GeoJSON that cross the meridian

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Geo
    • None
    • ALL
    • Hide
      • create a collection with a geojson polygon that crosses the merdian (with longitude < -180 or > 180)
      • create an index on the collection
      • see error "longitude/latitude is out of bounds"
        > db.shapefiles.createIndex({geometry:"2dsphere"})
        {
                "ok" : 0,
                "errmsg" : "Can't extract geo keys: { _id: ObjectId('5add7cb127dcb663e5995e15'), type: \"Feature\", properties: { CELLX: -1292, CELLY: 2800, CLAT: 68.5077661, CLONG: -179.9914767, CX: -1046520, CY: 2268000 }, geometry: { type: \"Polygon\", coordinates: [ [ [ -180.00428, 68.5097566 ], [ -179.9861529, 68.5125547 ], [ -179.9786755, 68.5057748 ], [ -179.9967985, 68.5029775 ], [ -180.00428, 68.5097566 ] ] ] } }  longitude/latitude is out of bounds, lng: -180.004 lat: 68.5098",
                "code" : 16755,
                "codeName" : "Location16755"
        }
        
      Show
      create a collection with a geojson polygon that crosses the merdian (with longitude < -180 or > 180) create an index on the collection see error "longitude/latitude is out of bounds" > db.shapefiles.createIndex({geometry:"2dsphere"}) { "ok" : 0, "errmsg" : "Can't extract geo keys: { _id: ObjectId('5add7cb127dcb663e5995e15'), type: \"Feature\", properties: { CELLX: -1292, CELLY: 2800, CLAT: 68.5077661, CLONG: -179.9914767, CX: -1046520, CY: 2268000 }, geometry: { type: \"Polygon\", coordinates: [ [ [ -180.00428, 68.5097566 ], [ -179.9861529, 68.5125547 ], [ -179.9786755, 68.5057748 ], [ -179.9967985, 68.5029775 ], [ -180.00428, 68.5097566 ] ] ] } } longitude/latitude is out of bounds, lng: -180.004 lat: 68.5098", "code" : 16755, "codeName" : "Location16755" }

      I have a large GeoJSON collection with some polygons that crosses the date line. Because of that these polygons, I am not able to create a 2dsphere index on the collection.

      Different GIS tools handle this use case differently. Some opts to support longitude that < -180 and > 180 to represent shapes that cross the merdian the short way, instead of the long way (across the other side of the globe).

      MongoDB as a database system that stores these data, should be generic enough to handle this use case.

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            ching Ching Chang
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: