DarshanGowda0 / GeoFlutterFire

:fire:GeoFlutterFire:fire: is an open-source library that allows you to store and query firestore documents based on their geographic location.
https://youtu.be/MYHVyl-juUk
MIT License
305 stars 261 forks source link

How GeoFlutterFire works #6

Closed DavidCorrado closed 5 years ago

DavidCorrado commented 5 years ago

Might be useful to describe technically how this library works as it will help people make the decision to use this library. From my understanding this is how it works:

Geohash technical details The library generates a 9 character geohash based off the lat long. This hashcode defines a rectangular box which is accurate within 5 meters you can see here

Based on the radius you send when doing Geo-Queries we reduce the number of characters in the geohash which increases the size of the rectangular box that covers the radius given above. We run the query based on that shortened geohash on the server side. Then locally we filters out data based on the circle generated by the radius.

Note: Knowing that this library mostly runs on the server side makes this library be a big win which is not as clear from the description.

Once again thanks for all the work.

DarshanGowda0 commented 5 years ago

Hi @DavidCorrado, yes your description pretty much covers it. The library was heavily influenced by GeoFireX which has a brief technical explanation with a tutorial. Also, there's gonna be a small article/video from fireship regarding GeoFlutterFire soon.