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

Cannot create 2dsphere index on GeoJSON data

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.5.3
    • Component/s: Geo
    • Environment:
      CentOs, OSX Mountain LIon
    • Linux
    • Hide

      Insert GeoJSON record specified in attachment into a new collection. Attempt to create a 2dsphere index on that collection using the following command:
      db.btest.ensureIndex(

      {geometry:"2dsphere"}

      )

      Show
      Insert GeoJSON record specified in attachment into a new collection. Attempt to create a 2dsphere index on that collection using the following command: db.btest.ensureIndex( {geometry:"2dsphere"} )

      I have shape data file data which I converted to GeoJSON using QGIS 1.7.3 for Mac. I parsed out each GeoJSON object from the generated file and then wrote out each object (one object per line) to an output file. Finally, I loaded that output file into mongo using the 'mongoimport' utility, creating a new collection for the data.

      I then log in to the database using the 'mongo' tool and attempt to create a '2dsphere' index on the newly created collection. About 18% of the way through the data I receive the error

      "Can't extract geo keys from object, malformed geometry?"
      This sounds similar to ticket SERVER-9401

      I've checked http://geojsonlint.com and the GeoJSON mentioned in the error passes and successfully renders.

      I've attached the exact error and its output to the ticket

      { type: "Polygon", coordinates: [ [ [ -73.99625346569333, 40.76190478805697 ], [ -73.99609819005899, 40.76212541008178 ], [ -73.99589543781777, 40.76203152905607 ], [ -73.99612203263234, 40.76172143380322 ], [ -73.99614119142737, 40.76169823745224 ], [ -73.99713046436048, 40.76211428136805 ], [ -73.99678540634655, 40.76258863993873 ], [ -73.9959938151665, 40.76225573199486 ], [ -73.99609819005899, 40.76212541008178 ], [ -73.99647687902545, 40.76227949768229 ], [ -73.99650084085626, 40.76224545124312 ], [ -73.99670747493275, 40.76232952932145 ], [ -73.99682613447295, 40.76216093031877 ], [ -73.99629031476267, 40.76194290760107 ], [ -73.99630296782105, 40.7619249303378 ], [ -73.99625346569333, 40.76190478805697 ] ] ] }

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            rgordon1982 Robert Gordon
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: