jjzjj

centerSphere

全部标签

python 前夕 0.8 : how to perform a $geowithin with a $centerSphere?

我们已经部署了一个docker容器,其中运行着一个MongoDB数据库。这是一个简单的数据库,我们在其中存储地理引用传感器数据(例如温度、风速)。由于我们想要查询基于搜索半径的这些地理引用观察,我们启用了这样的空间查询:db.ObsStationTemp.createIndex({point:"2dsphere"})db.ObsStationTemp.ensureIndex({"geometry":'2dsphere'})数据在MongoDB中被正确提取,我们实际上可以像这样执行空间查询:db.ObsStationTemp.find({geometry:{$geoWithin:{$ce

mongodb - 在Mongodb中查询公里半径的位置?

我有一个名为restaurants..的集合,并且我已经格式化为geoJSON并且我尝试通过以下方式查询db.restaurants.find({location:{$geoWithin:{$centerSphere:[[-73.93414657,40.82302903],5/3963.2]}}})我提到了半径5/3963.2(以英里为单位计算)..但我需要以公里为单位的半径距离,如{$centerSphere:[[-73.93414657,40.82302903],5]}我需要提到以千米为单位的半径怎么做? 最佳答案 MongoD

mongodb - 如何使用 mgo 编写查询 $centerSphere

我已阅读文档here讨论编写查询以获取半径内的某个位置:db.restaurants.find({location:{$geoWithin:{$centerSphere:[[-73.93414657,40.82302903],5/3963.2]}}})现在我尝试使用mgo驱动程序编写它,但我不知道如何在此处编写我尝试过的内容:varcites[]Citycollection:=mongo.DB("Db").C("Collection")err=collection.Find(bson.M{"location":bson.M{"$geoWithin":bson.M{"$centerSph

mongodb - 在 MongoDB 中,如何使用文档中的字段作为 $geoWithin/$centerSphere 表达式的输入?

我正在尝试编写一个MongoDB查询,用于搜索以指定位置为中心的半径内的文档。下面的查询有效。它查找在searching.coordinates的searching.radius弧度内的所有文档。但是我想做的是将当前文档的allowed_radius值添加到searching.radius值中,这样允许的球体实际上更大。我怎样才能使这个查询成为可能?当前查询:collection.aggregate([{$project:{location:"$location",allowed_radius:"$allowed_radius"}},{$match:{$and:[{location:{

mongodb - 在 MongoDB 中,如何使用文档中的字段作为 $geoWithin/$centerSphere 表达式的输入?

我正在尝试编写一个MongoDB查询,用于搜索以指定位置为中心的半径内的文档。下面的查询有效。它查找在searching.coordinates的searching.radius弧度内的所有文档。但是我想做的是将当前文档的allowed_radius值添加到searching.radius值中,这样允许的球体实际上更大。我怎样才能使这个查询成为可能?当前查询:collection.aggregate([{$project:{location:"$location",allowed_radius:"$allowed_radius"}},{$match:{$and:[{location:{