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

Edges cross error for near edges

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 3.4.9
    • Fix Version/s: None
    • Component/s: Geo
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      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]" } }) >

      Description

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

        Attachments

        1. polygon.geojson
          0.4 kB
        2. polygon.png
          polygon.png
          981 kB
        3. polygon-fixed.png
          polygon-fixed.png
          783 kB

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: