我有一个关于在$maxDistance中测量距离的问题。我有文件:
{
"location": {
{ "type" : "Point", "coordinates" : [ 38.8993487, -77.0145665 ] }
}
}在shell中进行查询:
db.places.find({"location": {"$nearSphere": {"$geometry": {"type":"Point", "coordinates": [38.888684, -77.0047189]}, "$maxDistance": 1129 } }})[0].location返回
{ "type" : "Point", "coordinates" : [ 38.8993487, -77.0145665 ] }但gpsvisualizer.com所做的距离测量显示,为1.4600公里。maxDistance设置为1129米的Mongo有一个结果
所以我的问题是-我错过了什么?
发布于 2015-06-23 15:03:16
我想你忽略了事实,mongoDB的2d球面索引运算符只识别经度,纬度顺序。正确的链接是:观想器。如你所见,这些点之间的距离约为1,13公里:)
https://stackoverflow.com/questions/31001143
复制相似问题