我们想在地图中显示所有这些位置。当用户放大时,我们只需要检索地图可见区域内的位置。Map 给了我们 swPoint 和 nePoint 的坐标。
我们想要获得所有位置在 2 个点(swPoint,nePoint)。基本上是一个盒子内的所有位置。我们创建了 db.locations.createIndex({ "outdoor.location": "2dsphere" }) 的索引,感谢您的帮助。
以下是示例位置数据:
[{
"outdoor": {
"location": {
"type": "Point",
"coordinates": [
-92.41151,
35.11683
]
}
},
"geoHash": "dr72jwgnbbst"
},
{
"outdoor": {
"location": {
"type": "Point",
"coordinates": [
-89.58342,
36.859161
]
}
},
"geoHash": "dn6qtkr5xk8m"
},
{
"outdoor": {
"location": {
"type": "Point",
"coordinates": [
-86.038762,
36.519016
]
}
},
"geoHash": "dn6zf0h6xtcp"
},
{
"outdoor": {
"location": {
"type": "Point",
"coordinates": [
-98.3081936,
26.2143207
]
}
},
"geoHash": "9udj4unjmp9f"
},
{
"outdoor": {
"location": {
"type": "Point",
"coordinates": [
-98.5377275,
29.4878928
]
}
},
"geoHash": "9v1zv8p52t8u"
},
{
"outdoor": {
"location": {
"type": "Point",
"coordinates": [
-73.7018126,
42.641387
]
}
},
"geoHash": "dreddfeup69m"
},
{
"outdoor": {
"location": {
"type": "Point",
"coordinates": [
-111.865295,
33.431942
]
}
},
"geoHash": "9tbqnqn5jtwq"
},
{
"outdoor": {
"location": {
"type": "Point",
"coordinates": [
-79.810763,
34.174603
]
}
},
"geoHash": "dnp4rv796rtz"
}
]
谢谢