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

2dsphere index does not accept valid GEOJSON with 3 coordinates

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.4.10
    • Fix Version/s: None
    • Component/s: Geo
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      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

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: