【发布时间】:2015-02-17 00:50:03
【问题描述】:
如何在 MongoDB 中使用地理空间查询来确定,由 Point 和 radius 确定的圆是否与 LineString 相交?
用例:
MongoDB GeoJson LineString 对象定义如下:
db.places.insert(
{
loc : { type: "LineString", coordinates: [ [-121.9420624, 37.3734995], [ -121.9388008, 37.3755458], [-121.9408607, 37.3720671] ] },
name: "Small trail"
});
用户位置是 [ -121.928887, 37.299849 ] 如何判断一个以用户位置为中心,半径为10英里的圆是否与LineString相交?
我期待一个类似的查询
db.places.find({loc : {$geoIntersects :{$geometry :{$centerSphere: [ [ -121.928887, 37.299849 ], 100 / 3959 ]}}}});
但是这个不行
【问题讨论】:
标签: mongodb geospatial