简体   繁体   English

将地理数据导入Mongodb时出错:无法从对象,格式错误的几何体中提取地理键

[英]Error when importing geo data to Mongodb : Can't extract geo keys from object, malformed geometry

I am trying to import some geo data (more than 40K) to mongodb(3) but I get sometime an error for some documents: 我试图将一些地理数据(超过40K)导入到mongodb(3),但有时某些文档会出错:

"code" : 16755,
"errmsg" : "insertDocument :: caused by :: 16755 Can't extract geo keys from object, malformed geometry

I have checked the document and it's a valid geojson, respecting mongodb format [long, lat]. 我检查了文档,它是一个有效的geojson,尊重mongodb格式[long,lat]。 And when I insert the document without the polygon, it works... 当我插入没有多边形的文档时,它可以...

I cannot figure out what's wrong with those polygons. 我无法弄清楚那些多边形有什么问题。 Here is an example: 这是一个例子:

Thanks for help. 感谢帮助。

{
  name: "Alco",
  slug: "alco-montpellier",
  cities: ["MONTPELLIER"],
  polygon: {
    type: "Polygon",
    coordinates: [
        [
            [3.834017, 43.610297],
            [3.833734, 43.610352],
            [3.832791, 43.612713],
            [3.832684, 43.613476],
            [3.832791, 43.614735],
            [3.830752, 43.614796],
            [3.829067, 43.614578],
            [3.831064, 43.617001],
            [3.832523, 43.61924],
            [3.832716, 43.619938],
            [3.833925, 43.620975],
            [3.834285, 43.621277],
            [3.834561, 43.621804],
            [3.834534, 43.621753],
            [3.834561, 43.621803],
            [3.835378, 43.622456],
            [3.835416, 43.622468],
            [3.835417, 43.622473],
            [3.836562, 43.622849],
            [3.835891, 43.624896],
            [3.838081, 43.626389],
            [3.839628, 43.627281],
            [3.840811, 43.628289],
            [3.841549, 43.629196],
            [3.842159, 43.631116],
            [3.84352, 43.629856],
            [3.845636, 43.628679],
            [3.846009, 43.628236],
            [3.846367, 43.62771],
            [3.847108, 43.627283],
            [3.848243, 43.62677],
            [3.850334, 43.625332],
            [3.852267, 43.624563],
            [3.853425, 43.623907],
            [3.854275, 43.623266],
            [3.854834, 43.622371],
            [3.85659, 43.621271],
            [3.857811, 43.62069],
            [3.855053, 43.620195],
            [3.852897, 43.620075],
            [3.852789, 43.620075],
            [3.850239, 43.620028],
            [3.847899, 43.619022],
            [3.844711, 43.618395],
            [3.843713, 43.617984],
            [3.842315, 43.617007],
            [3.840065, 43.615578],
            [3.839092, 43.613684],
            [3.838844, 43.612444],
            [3.838938, 43.610591],
            [3.838526, 43.609439],
            [3.834017, 43.610297]
        ]
    ]
  },
  centroid: {
    type: "Point",
    coordinates: [3.84344, 43.6203]
  }
}

If you insert the document via Mongo Shell in MongoDB v3.0, you should see an error message: 如果您通过MongoDB v3.0中的Mongo Shell插入文档,您应该会看到一条错误消息:

  "writeError": {
    "code": 16755,
    "errmsg": "Can't extract geo keys: ... 
    Loop is not valid: ...
    ...
    Edges 11 and 13 cross. Edge locations in degrees: [3.8342850, 43.6212770]-[3.8345610, 43.6218040] and [3.8345340, 43.6217530]-[3.8345610, 43.6218030]

Checking those coordinates, they are too close together (almost identical) that creates an anomaly in the polygon shape: [3.834561, 43.6218 04 ] and [3.834561, 43.6218 03 ]. 检查那些坐标,它们太靠近(几乎相同),在多边形形状中产生异常:[3.834561,43.6218 04 ]和[3.834561,43.6218 03 ]。

If we visualise it in geodndmap.mongodb.com , you can see that there is a tiny edge causing an invalid loop. 如果我们在geodndmap.mongodb.com中将其可视化,您可以看到存在导致无效循环的微小边缘。 This edge crossing is caused by the coordinates above. 这个边缘交叉是由上面的坐标引起的。

无效的多边形循环

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Mongodb错误:无法从对象,格式错误的几何体中提取地理位置键? - Mongodb error : Can't extract geo keys from object, malformed geometry? MongoDB错误“无法从对象,格式错误的几何图形中提取地理关键字吗?” - MongoDB error “can't extract geo keys from object, malformed geometry?” 插入类型多边形时,MongoDB GeoJSON“无法从对象,格式错误的几何体中提取地理键?” - MongoDB GeoJSON “Can't extract geo keys from object, malformed geometry?” when inserting type Polygon 具有有效GEOJSON多边形的文档上的2dsphere索引因错误而失败:无法从对象,格式错误的几何图形中提取地理关键字? - 2dsphere Index on Document with Valid GEOJSON Polygon Fails with Error: Can't extract geo keys from object, malformed geometry? MongoDB:GeoJSON object 类型索引,无法提取地理键 - MongoDB: GeoJSON object type index, Can't extract geo keys “MongoError:无法从对象中提取地理键”,类型:点 - "MongoError: Can't extract geo keys from object" with Type : Point 无法提取地理键 - 使用 Atlas 而不是本地 MongoDB - Can't extract geo keys - Working with Atlas but not Local MongoDB 使用Multi Polygon将文档插入MongoDB“无法提取地理键” - Inserting document into MongoDB "can't extract geo keys" with Multi Polygon 模式中的猫鼬geojson,“无法提取地理键”错误 - mongoose geojson in schema, “Can't extract geo keys” error 错误16755 - Mongo无法提取地理密钥 - Error 16755 - Mongo can't extract geo keys
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM