Closed matobaa closed 2 years ago
四隅の座標をLeafletのgetBound(https://leafletjs.com/reference-1.6.0.html#map-getbounds) で取得して、 座標を元にFirebaseから検索して取得、という流れですかね。
経度範囲と緯度範囲を一度に検索条件に含められない、とのことなので、geohashを勉強している。 https://firebase.google.com/docs/firestore/solutions/geoqueries?hl=ja
このライブラリがよさそう: https://github.com/sunng87/node-geohash CDNから持ってくるとエラーが出る……影響ないけど気になる
もうひとつライブラリを見つけた: https://github.com/chrisveness/latlon-geohash
現在の実装では地物を全件検索して地図上にプロットしているが、地物が多くなると処理が重くなることが予想されるため、画面範囲内だけを検索するなどの工夫をしたい。