asahina820 / Study-Map

1 stars 0 forks source link

座標で範囲検索したい #22

Closed matobaa closed 2 years ago

matobaa commented 2 years ago

現在の実装では地物を全件検索して地図上にプロットしているが、地物が多くなると処理が重くなることが予想されるため、画面範囲内だけを検索するなどの工夫をしたい。

asahina820 commented 2 years ago

四隅の座標をLeafletのgetBound(https://leafletjs.com/reference-1.6.0.html#map-getbounds) で取得して、 座標を元にFirebaseから検索して取得、という流れですかね。

matobaa commented 2 years ago

経度範囲と緯度範囲を一度に検索条件に含められない、とのことなので、geohashを勉強している。 https://firebase.google.com/docs/firestore/solutions/geoqueries?hl=ja

matobaa commented 2 years ago

このライブラリがよさそう: https://github.com/sunng87/node-geohash CDNから持ってくるとエラーが出る……影響ないけど気になる

matobaa commented 2 years ago

もうひとつライブラリを見つけた: https://github.com/chrisveness/latlon-geohash