我有一个包含形式的纬度和经度的mongodb数据库:
例如{a:1,纬度:1.0,经度:2.0,b:2}等
我想检查纬度经度对是否以坐标退出。
我在
中查询了该文档collecton = db['DbName']
cursor = collection.find()
for doc in cursor:
collection.find({"LondonCoordinates":{"$geoIntersects":{"$geometry":{"type":"Point", "coordinates":[longitude1, latitude1]}}}}
以及:
for doc in cursor:
collection.find({loc: {$geoWithin: {$geometry: {type : "Polygon" ,coordinates: [[[ -0.5103750999999999, 51.286760199999996], [ -0.5103750999999999, 51.6918741],[ 0.33401549999999997, 51.6918741],[ 0.33401549999999997, 51.286760199999996], [ -0.5103750999999999, 51.286760199999996]]]}}}})
这些似乎不起作用。我想要的是真值/假值,无论是[doc ["经度"],doc [" Latitude"]]是否存在于多边形中。