由於某些原因,如果半徑設置爲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