我正在尝试将一些地理数据(超过40K)导入mongodb(3),但有时某些文档会出错:
"code" : 16755, "errmsg" : "insertDocument :: caused by :: 16755 Can't extract geo keys from object, malformed geometry
我已检查过该文档,它是一个有效的geojson,尊重mongodb格式[long,lat]。当我插入没有多边形的文档时,它可以工作......
我无法弄清楚这些多边形有什么问题。这是一个例子:
感谢您的帮助。
{
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]
}
}
答案 0 :(得分:6)
如果您通过MongoDB v3.0中的Mongo Shell插入文档,您应该会看到一条错误消息:
Private Sub App_WorkbookActivate(ByVal Wb As Workbook)
Module1.MyRibbon.Invalidate
End Sub
检查那些坐标,它们太靠近(几乎相同),在多边形形状中产生异常:[3.834561,43.6218 04 ]和[3.834561,43.6218 03 ]。
如果我们在geodndmap.mongodb.com中对其进行可视化,您会发现有一个微小的边缘导致无效的循环。这个边缘交叉是由上面的坐标引起的。