问题描述
我在mongodb中使用$ near函数查询比值更近的位置,但是它发现位置的距离比gmaps或网络上任何其他距离计算器计算的两个坐标之间的距离远。相差910米和1177米。你能帮我为什么吗?
db.places.insert( {
name: "A",location: { type: "Point",coordinates: [ 47.512368,19.064032 ] }
} );
db.places.insert( {
name: "B",coordinates: [ 47.517489,19.073425 ] }
} );
db.places.createIndex( { location: "2dsphere" } )
db.places.find(
{
location:
{ $near:
{
$geometry: { type: "Point",19.064032 ] },$mindistance: 0,$maxdistance: 1177
}
}
}
)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)