我有一列点(纬度,经度)的点的列表。我已经对这些数组做了一个索引,现在我想知道一个点是否在该多边形内。
MongoDB有可能吗?
我已经尝试过使用这些命令,但没有运气:
> polygonA = [ [ 48.780809,2.307129],[ 48.781809,2.300129],[ 48.770809,2.317129]]
> db.contours.find({ "rings.ring" : { "$within" : { "$polygon" : polygonA } } })和
> db.runCommand( { geoNear : "contours" , within : [2.307129,48.780809,], num : 10 } );我的数据结构是:
> db.contours.findOne({},{'rings':0})
{
"_id" : ObjectId("50364617d591ac166000c196"),
"foundfieldname" : "Name",
"geometrytype" : "geometryPolygon",
"attributes" : {
"Shape" : "Polygon",
"Name" : "France",
"Type" : "Country",
"Country" : "France",
"Area" : "1162358716567.45"
},
"country" : "France",
"rings":{
"ring":[[12.32,43.54],...],
...
}谢谢