由于某些原因,如果半径设置为1197或更高,我的Geofire查询仅返回物品。更少,也不会返回任何内容。当数据返回并记录距离时,它们都小于1km,所以这对我没有任何意义。当设置巨大半径时,Firebase Geofire查询仅返回附近的物品
这个的任何想法?
代码:
this.firebaseRef = new Firebase("<my firebase - this is fine>");
this.geoFire = new GeoFire(this.firebaseRef);
this.geoQuery = this.geoFire.query({
center: [50.72001, -1.8800],
radius: 1197
});
this.geoQuery.on("key_entered", function(key, location, distance){
console.log(key + ', ' + location + ', ' + distance);
});
我要提到我使用的反应,这是在componentWillMount方法。
谢谢!
更新: Geofire似乎需要一个Geohash来搜索数据库,所以要解决我的问题,我开始将lat/lng转换为geohashes并将其存储。
GeoFire提供了用于保存应该以您的名义创建geohash的lat/long的方法。这些可能会有所帮助。 – Kato