Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to use GeoFire with Firestore?

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?

like image 795
urgentx Avatar asked Oct 03 '17 21:10

urgentx


People also ask

Can I use both realtime database and firestore?

You can use both Firebase Realtime Database and Cloud Firestore in your app, and leverage each database solution's benefits to fit your needs. For example, you might want to leverage Realtime Database's support for presence, as outlined in Build Presence in Cloud Firestore.

Is firestore too expensive?

Although Firestore is very affordable with little usage, costs start to increase as you begin to scale. In most cases, the cost of using Firestore at scale is more expensive than other providers.

How do I use Realstore and firestore database?

The Firestore and the Firebase Realtime database are NoSQL database that means there is no need to create the table and define the schema. In the Realtime database, data is stored as one large JSON tree. In Cloud Firestore, data is stored as a collection of documents. The data is simple, so it is very easy to store.

Is firestore key value store?

In Firestore, you typically have a single collection and multiple documents in that collection. To use Firestore as a key/value store for Workflows, one idea is to use the workflow name as the collection name and use a single document to store all the key/value pairs.


2 Answers

Edit (Dec 17th, 2020): we have recently released a set of geo utility libraries and a guide to explain how to use them to implement simple geo queries on Firestore!

https://firebase.google.com/docs/firestore/solutions/geoqueries

While we still don't have native geo queries in the database, these Android, iOS, and Web libraries will help you use Geohashes to get geo querying functionality.


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!

like image 111
Sam Stern Avatar answered Sep 17 '22 15:09

Sam Stern


GREAT NEWS. There is now a library for both iOS and Android that replicates GeoFire for Firestore. The library is called GeoFirestore. It has full documentation and is well tested. I currently use it in my app and it works brilliantly. The code is very similar to that of GeoFire so it should only take a few minutes to learn.

like image 29
Nikhil Sridhar Avatar answered Sep 19 '22 15:09

Nikhil Sridhar