mongo 2.6
我有一些存储的多边形,还有一个点。我想知道这个点是否适合任何存储的多边形。
文档示例
{ ..., "polygons" : [ [ 17.60083012593064, 78.18557739257812 ], [ 17.16834652544664, 78.19381713867188 ], [ 17.17490690610013, 78.739013671875 ], [ 17.613919673106714, 78.73489379882812 ] ], ... }
已经有一个几乎相同的问题了 Mongodb : Check if a point is inside a stored polygon。 但是对于我来说它不起作用 - 这个查询至少要给出一个结果(例如中的那个),但它没有。
db.areas.find( { polygons : { $geoIntersects : { $geometry : {type:"Point",coordinates:[17.3734, 78.4738]} } } } )
实际上,如果我选择多边形边界上的一个点-它确实有效。
$geoWithin
方法必须按照 mondodb
文档所述执行工作。
但是任何这些查询都不起作用。
db.areas.find( { polygons : { $geoWithin : { $geometry : {type:"Point",coordinates:[17.3734, 78.4738]} } } } ) - not supported with provided geometry
db.tradeareas.find( { polygons : { $geoWithin : { $geometry : {type:"Polygon",coordinates: inside_polygon} } } } ) - BadValue bad geo query
看起来我错过了什么,但不明白是什么和在哪里。
如果能得到帮助将不胜感激。