Is there a way to use GeoFire with Firestore?

urgentx picture urgentx · Oct 3, 2017 · Viewed 18.4k times · Source

GeoFire is tightly coupled to the Realtime Database, while geo-queries are a common functional dependency of many apps that are looking to migrate to Firestore. Is there any way to replicate the hashing/retrieval of locations in the Firestore environment?

Answer

Sam Stern picture Sam Stern · Oct 4, 2017

Edit (July 1st, 2019): When I originally wrote the answer below I was optimistic that native geo queries would come to Cloud Firestore soon, which clearly did not happen. It's still in the long-term plans, but for now the best option is to use a community-built library or make your own using either GeoHashes or the S2 Geometry library.

The GeoFire libraries for Realtime Database were built using GeoHashes and porting the logic of those libraries to Cloud Firestore should be relatively simple.


Sam from the Cloud Firestore team here. As SUPERCILEX said, Cloud Firestore has support for the GeoPoint data type already. We are working hard to bring native geo queries to the product.

Because native geo queries are coming, we will not be porting GeoFire to Cloud Firestore. Instead we will redirect that engineering effort to getting the native queries sooner.

If you need geo queries today and don't want to build your own library, stick with Realtime Database!