为表‘MSParcels’创建索引时出错: WriteConcern检测到错误‘无法从对象中提取地理关键字,几何图形格式错误?:
{ 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 ] ] ] } 问题是,我从SQL Server复制,其中相同的坐标传递STIsValid
使用C#驱动程序MongoDB.Driver.Builders.IndexKeys.GeoSpatialSpherical
Mongo版本2.4.4
有什么建议吗?
发布于 2013-06-13 17:25:44
geojson对mongodb无效-它只接受x,y坐标,而不接受z坐标(高度)。这是因为它只有2D索引/查询功能。
您需要从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-13 06:56:37
你的坐标无效。geojson多边形是由具有两个坐标而不是三个坐标的数组组成的数组(额外的0.0)
https://stackoverflow.com/questions/17076132
复制相似问题