-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GeoQuery is only returning nearby keys if a huge radius is set #80
Comments
I found that this issue was caused by not having a geohash property, only a coordinates array. This could be worth mentioning in the Readme? I had no clue about the geohash previously, but converting the lat/lng to a geohash and storing that makes it work as expected. |
I'm not quite sure what you mean by this. The geohashing should be transparent to a user of the GeoFire library since it all happens behind the scenes with |
Sorry, probably should have explained my use-case a bit more clearly. I'm currently working on a web-version of an iOS app that uses GeoFire. For development we set up a new test Firebase to use. We probably went about it in an unorthodox way, by recreating the live Firebase's structure ourselves.
This method generates a key by itself, so Anyway, when we came to using GeoFire, I could only get results if the radius was some crazy high value, which sparked a bit of confusion for me (as outlined in the OP) because GeoFire was outputting the distance as very small. After being confused for a while I decided to test with the live Firebase and it worked just fine. Upon comparing the two Firebases, I saw the problem. It turns out that there was a Now the coordinates are converted to a geohash, it's assigned to Sorry for having opened up the issue, as obviously it was a mistake on my end, however it would have been a lot clearer what went wrong if there was some more comprehensive documentation that went over how the whole thing works. The only way I found out that there was such a thing as a geohash was by digging into the iOS version where references to "geohash" are made. Hopefully this clears everything up! Thanks! |
Cool, thanks for the writeup. We don't include information about geohashes in the README since 99% of devs don't even need to know they exist under the hood. Re-creating the underlying GeoFire structure is possible but not recommended as it can change in the future (and has changed in the past). We typically recommend that you store all the extra data in a separate node with the same keys as used in GeoFire. It requires an extra lookup but brings a lot of benefits. I talk about this strategy in issue #40. |
I know that this issue is old and long closed, but this issues still stands for me even though my geohashes are being automatically stored. Any other reason why my radius has to be ridiculously high before my geoQuery will return results? |
Hey there, please open up a new issue and fill out the issue template with a repro of your issue. Without that, it's hard to guess what is going wrong. |
Same issue here |
My Geofire query only returns something if the radius is set to a seemingly arbitrary 1197 or above. Any less and nothing will be returned. When the data is returned and I log the distances, they are all less than 1, so this doesn't make any sense to me.
Any ideas for why this is occurring?
Code:
Thanks!
Lawrence
The text was updated successfully, but these errors were encountered: