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

2dsphere index does not accept valid GEOJSON with 3 coordinates

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.10
    • Component/s: Geo
    • None
    • ALL
    • Hide
      • create 2dsphere index on loc
      • try: db.locations.insert({"loc": {"type": "Point", "coordinates" : [ 1,2,3 ]}})
      • which fails with: Can't extract geo keys from object, malformed geometry?: {type:"Point", coordinates: [ 1.0, 2.0, 3.0 ] }
      • try: db.locations.insert({"loc": {"type": "Point", "coordinates" : [ 1,2 ]}})
      • which is fine
      Show
      create 2dsphere index on loc try: db.locations.insert({"loc": {"type": "Point", "coordinates" : [ 1,2,3 ]}}) which fails with: Can't extract geo keys from object, malformed geometry?: {type:"Point", coordinates: [ 1.0, 2.0, 3.0 ] } try: db.locations.insert({"loc": {"type": "Point", "coordinates" : [ 1,2 ]}}) which is fine

      Creating a 2dsphere index fails if the coordinates part of the documents has 3 coordinates. Having 3 or more coordinates is valid geojson as stated in the spec:
      A position is represented by an array of numbers. There must be at least two elements, and may be more. The order of elements must follow x, y, z order (easting, northing, altitude for coordinates in a projected coordinate reference system, or longitude, latitude, altitude for coordinates in a geographic coordinate reference system). Any number of additional elements are allowed – interpretation and meaning of additional elements is beyond the scope of this specification.

            Assignee:
            Unassigned Unassigned
            Reporter:
            this.wiederkehr This Wiederkehr
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: