You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+54-3Lines changed: 54 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,8 @@ Realtime Geolocation with Firestore & RxJS
10
10
npm install firebase geofirex
11
11
```
12
12
13
+
#### Initialize
14
+
13
15
The library is a lightweight client for the Firebase SDK that provides tools for handling geolocation data in Firestore.
14
16
15
17
```ts
@@ -22,6 +24,8 @@ import * as geofirex from 'geofirex';
22
24
const geo =geofirex.init(firebase);
23
25
```
24
26
27
+
#### Write Geo Data
28
+
25
29
First, you'll need to add some geolocation data in your database. A `collection` creates a reference to Firestore (just like the SDK), but with some extra geoquery features. The `geohash` method returns a class that helps you create geolocation data.
26
30
27
31
```ts
@@ -32,6 +36,8 @@ const point = geo.point(40, -119);
Now let's make a query Firestore for _cities.position within 100km radius of a centerpoint_.
36
42
37
43
```ts
@@ -53,17 +59,62 @@ query.subscribe(console.log);
53
59
54
60
Better docs soon...
55
61
56
-
### `init`
62
+
### `init(app: FirebaseApp)`
57
63
58
64
Initializes the GeoFireClient
59
65
66
+
```ts
67
+
import*asfirebasefrom'firebase/app';
68
+
import*asgeofirexfrom'geofirex';
69
+
firebase.initializeApp(yourConfig);
70
+
71
+
const geo =geofirex.init(firebase);
72
+
```
73
+
60
74
### `collection`
61
75
62
-
Returns a GeoFireCollectionRef instance
76
+
Creates reference to a Firestore collection that can be used to make geo-queries and perform writes If you pass a query, any subsequent geo-queries will be limited to this subset of documents
0 commit comments