1

MongoDBデータベースで空間クエリを作成しようとしています (geoNear.

計算された距離がまったく正確でないことを除いて、それは機能します。だから、ここに私が持っているものがあります:

> db.status.find()
{
    "_id":NumberLong(5),
    "location":{
        "latitude":48.8947767,
        "longitudes":2.103352099999997
    }
}

私はインデックスを持っています:

> db.status.getIndexes()
[
    {
        "v" : 1,
        "key" : {
            "_id" : 1
        },
        "ns" : "aroundb.status",
        "name" : "_id_"
    },
    {
        "v" : 1,
        "key" : {
            "location" : "2dsphere"
        },
        "ns" : "aroundb.status",
        "name" : "location_2dsphere"
    }
]

そして、ここに私の質問があります:

db.runCommand({ geoNear:"status",near: [ 48.8947767, 2.093352099999997], spherical:true, distanceMultiplier:6371} )

結果は次のとおりです。

{
"ns" : "aroundb.status",
"results" : [
    {
        "dis" : 1.1119514223177513,
        "obj" : {
            "_id" : NumberLong(5),
            "location" : {
                "latitude" : 48.8947767,
                "longitudes" : 2.103352099999997
            }

        }
    }
],
"stats" : {
    "time" : 14,
    "nscanned" : 1,
    "avgDistance" : 1.1119514223177513,
    "maxDistance" : 1.1119514223177513
},
"ok" : 1

}

ご覧のとおり、計算された距離 (km で計算するために地球の半径を掛けたもの) は 1.1119514223177513 km です。

ウェブサイトhttp://www.lexilogos.com/calcul_distances.htmで距離を計算すると、計算された距離は 0.7312508492264875 km です。

Google マップを使用すると、距離も 0.7312508492264875 km です。

だから、問題は:私が間違っているのは何ですか?

4

1 に答える 1