MichaelSolati / geofirestore-js

Location-based querying and filtering using Firebase Firestore.
https://geofirestore.com
MIT License
505 stars 58 forks source link

Question about precision and GeoKit #165

Closed boldtrn closed 4 years ago

boldtrn commented 4 years ago

Sorry for posting a question as issue, but I couldn't see a better way to ask questions about this repo.

First of all, I was wondering why this repository doesn't rely on GeoKit to encode/decode the GeoHashes? Wouldn't it be easier to rely on the shared functionality or is there anything fundamentally different in both implementations, maybe some tuned especially for Firestore?

Why did you choose the precision to be 10? To be able to provide higher quality results for the closest point query? Did you test how performance and storage needs compare to using a precision of 9 in FireStore? I could also see that GeoKit uses a precision of 10 as default. So I am wondering what the reason is.

MichaelSolati commented 4 years ago

Geokit was created around the same time as geokit but was intended as a utility so I can teach about geohashes. I tested results I got from the library against geofire and when comparing the logic/results I discovered they used a precision of 10 (so I did too).

As for the precision of 10, it provides an accuracy of approximately +/- 0.0011875 km. Which is really good, we don't lose a lot as far as the original location, but if you wanted less or more precision geokit allow you to pass your precision in as an argument.

I'll admit I didn't do much testing here for geofirestore. geofirestore started as a fork of geofire, so I just used the same logic the Firebase did for making a geoquery with the Firebase RTDB. (It has since gone through a lot of changes)

boldtrn commented 4 years ago

Thank you very much for the explanation, this helped me a lot to understand this better.