如何在没有GeoFire的情况下查询Firebase地理位置,以便根据两点之间的距离返回结果? [英] How could I query Firebase geo locations without GeoFire in order to return results based on distance between two points?
问题描述
我想知道的是存储地理位置值的最佳方法,这样我可以查询firebase,以便我们只返回用户周围的定义半径的位置。例如:用户定义他们希望距离他们20英里或更小的所有物品。
我想知道是否可以存储经纬度中的单个值,以便快速查询这些数据?或者,也许这不是正确的做法?
如果不实现某种geohash(这是geofire所做的),则无法使用纯Firebase。您可以使用弹性搜索或redis中存储的外部索引,例如
Firebase just updated their sdk to 3.x and the current version of GeoFire 2.x doesn't work.
What I would like to know is the best way to store geo location values so that I can query firebase so that we only return location with in a defined radius around the user.
Example: user defines that they would like all items that are within 20 miles or less from them.
I wonder if I could store a single value from the latitude and longitude that would allow me to quickly query for this data? Or maybe that isn't the right approach ?
It is not possible using pure firebase without implementing some sort of geohash (it is what geofire does). You could use an externa index stored in elastic search or in redis for example
这篇关于如何在没有GeoFire的情况下查询Firebase地理位置,以便根据两点之间的距离返回结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!