1

Error creating index for table 'MSParcels': WriteConcern detected an error 'Can't extract geo keys from object, malformed geometry?:

{ type: "Polygon", coordinates: 
    [ [ [ -122.118466012, 47.6511409501, 0.0 ], 
        [ -122.118687874, 47.6508529655, 0.0 ], 
        [ -122.118817718, 47.650852731, 0.0 ], 
        [ -122.118890754, 47.650852592, 0.0 ], 
        [ -122.118891979, 47.651140118, 0.0 ], 
        [ -122.118703033, 47.6511404878, 0.0 ], 
        [ -122.118466012, 47.6511409501, 0.0 ] ] ] } 

Problem is, I'm copying from SQL Server where identical coordinates pass STIsValid

Using C# driver MongoDB.Driver.Builders.IndexKeys.GeoSpatialSpherical

Mongo version 2.4.4

Any advice?

4

2 回答 2

1

geojson 对 mongodb 无效——它只接受 x,y 而不是 z 坐标(高度)。这是因为它只有二维索引/查询功能。

您需要从 geojson 文档中删除 z 坐标,如下所示:

{ type: "Polygon", coordinates: 
    [ [ [ -122.118466012, 47.6511409501], 
        [ -122.118687874, 47.6508529655], 
        [ -122.118817718, 47.650852731], 
        [ -122.118890754, 47.650852592], 
        [ -122.118891979, 47.651140118], 
        [ -122.118703033, 47.6511404878], 
        [ -122.118466012, 47.6511409501] ] ] } 

有一个功能请求来改进这个 - 请投票给:SERVER-9220

于 2013-06-13T09:25:43.787 回答
0

您的坐标无效。geojson 多边形是具有两个坐标而不是三个坐标的数组数组(额外的 0.0)

于 2013-06-12T22:56:36.780 回答