Tag: geospatial

MongoError:找不到任何特殊的索引:2d(需要索引),2dsphere(需要索引)$ nearSphere

这是我的第一个问题,所以如果问得不好,或者我的英文不好,请耐心等待。 我正在尝试在Node.js中在MongoDB中执行Geospatioal Querys 这个查询工作得很好 collection.find( { loc : { $geoWithin : { $centerSphere : [ [ point.coordinates[0], point.coordinates[1]] , getRadiusMeters(radius) ] } } } ) 但是当我试图用$ nearSphere做同样的事情时: collection.find( { loc :{ $nearSphere : { $geometry : { type : "Point" , coordinates : [ point.coordinates[0], point.coordinates[1]] } , $maxDistance : getRadiusMeters(radius) } } } ) […]

Cloudant中的距离计算

这是我正在努力解决的问题。 客户端通过由Node.js应用程序pipe理的API发送其当前位置。 Cloudant数据库存储坐标列表(几千)。 a)所有坐标列表的最佳方法是什么?b)客户位置的每个坐标的距离(c)落在客户位置半径的X公里范围内 已经为这些存储的坐标创build了地理空间索引。 速度和效率是关键,但有时这些可能是相反的品质。 如果可能的话,我更愿意使用Cloudant中的本地函数而不是自定义代码。

mongodb中的地理空间索引与node.js

我在find如下所示的定义地理空间索引“2d”的问题。 任何线索什么是错的? var Address = new Schema({ loc : {lat: Number, lng: Number }, Address : String, create_date : {type: Date, default: Date.now} }); Address.index ({ loc : "2d" }); 它抛出错误, events.js:45个参数[1]; //未处理“错误”事件^错误:在[对象对象] 处不在范围内 。 (/ cygdrive / c / Personal / software / nodejs / NODE / no de_modules / mongoose / node_modules / […]