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

Edges cross error for near edges

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.9
    • Component/s: Geo
    • None
    • ALL
    • Hide
      > db.createCollection('polygon_test')
      { "ok" : 1 }
      > db.polygon_test.createIndex({geometry: '2dsphere'})
      {
      	"createdCollectionAutomatically" : false,
      	"numIndexesBefore" : 1,
      	"numIndexesAfter" : 2,
      	"ok" : 1
      }
      > db.polygon_test.insert({
      ...   "type": "Feature",
      ...   "properties": {},
      ...   "geometry": {
      ...     "type": "Polygon",
      ...     "coordinates": [
      ...       [
      ...         [
      ...           -92.3262,
      ...           29.5319
      ...         ],
      ...         [
      ...           -92.3236,
      ...           29.5314
      ...         ],
      ...         [
      ...           -92.1092,
      ...           29.5311
      ...         ],
      ...         [
      ...           -92.8126,
      ...           29.53115
      ...         ],
      ...         [
      ...           -92.3262,
      ...           29.5319
      ...         ]
      ...       ]
      ...     ]
      ...   }
      ... })
      WriteResult({
      	"nInserted" : 0,
      	"writeError" : {
      		"code" : 16755,
      		"errmsg" : "Can't extract geo keys: { _id: ObjectId('59d65ac8452ead2f11d5af10'), type: \"Feature\", properties: {}, geometry: { type: \"Polygon\", coordinates: [ [ [ -92.3262, 29.5319 ], [ -92.3236, 29.5314 ], [ -92.1092, 29.5311 ], [ -92.8126, 29.53115 ], [ -92.3262, 29.5319 ] ] ] } }  Loop is not valid: [ [ -92.3262, 29.5319 ], [ -92.3236, 29.5314 ], [ -92.1092, 29.5311 ], [ -92.8126, 29.53115 ], [ -92.3262, 29.5319 ] ] Edges 0 and 2 cross. Edge locations in degrees: [-92.3262000, 29.5319000]-[-92.3236000, 29.5314000] and [-92.1092000, 29.5311000]-[-92.8126000, 29.5311500]"
      	}
      })
      > 
      
      Show
      > db.createCollection('polygon_test') { "ok" : 1 } > db.polygon_test.createIndex({geometry: '2dsphere'}) { "createdCollectionAutomatically" : false, "numIndexesBefore" : 1, "numIndexesAfter" : 2, "ok" : 1 } > db.polygon_test.insert({ ... "type": "Feature", ... "properties": {}, ... "geometry": { ... "type": "Polygon", ... "coordinates": [ ... [ ... [ ... -92.3262, ... 29.5319 ... ], ... [ ... -92.3236, ... 29.5314 ... ], ... [ ... -92.1092, ... 29.5311 ... ], ... [ ... -92.8126, ... 29.53115 ... ], ... [ ... -92.3262, ... 29.5319 ... ] ... ] ... ] ... } ... }) WriteResult({ "nInserted" : 0, "writeError" : { "code" : 16755, "errmsg" : "Can't extract geo keys: { _id: ObjectId('59d65ac8452ead2f11d5af10'), type: \"Feature\", properties: {}, geometry: { type: \"Polygon\", coordinates: [ [ [ -92.3262, 29.5319 ], [ -92.3236, 29.5314 ], [ -92.1092, 29.5311 ], [ -92.8126, 29.53115 ], [ -92.3262, 29.5319 ] ] ] } } Loop is not valid: [ [ -92.3262, 29.5319 ], [ -92.3236, 29.5314 ], [ -92.1092, 29.5311 ], [ -92.8126, 29.53115 ], [ -92.3262, 29.5319 ] ] Edges 0 and 2 cross. Edge locations in degrees: [-92.3262000, 29.5319000]-[-92.3236000, 29.5314000] and [-92.1092000, 29.5311000]-[-92.8126000, 29.5311500]" } }) >

      Cannot insert a polygon with near edges. Edges are very close to each other, but not crossing actually.

        1. polygon.geojson
          0.4 kB
          George Stepanov
        2. polygon.png
          981 kB
          Mark Agarunov
        3. polygon-fixed.png
          783 kB
          Mark Agarunov

            Assignee:
            mark.agarunov Mark Agarunov
            Reporter:
            gstepanov George Stepanov
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: