Comments (4)
Hi @Morzilla, I implement geofirestore in my project as well and I believe I can help.
You already add/set users to firestore, here is the relevant part.
Here I showing markers in a map inside a circle representing a radius
const collectionRef = this.affirestore.collection('publications').ref;
const geofirestore = new GeoFirestore(collectionRef);
const queryCriteria: QueryCriteria = {
center: [this.circle.latitude, this.circle.longitude],
radius: this.radius
};
this.geoQuery = geofirestore.query(queryCriteria);
this.showPublicationsMarkers();
...
showPublicationsMarkers() {
...
this.geoQuery.on('ready', () => {
console.log('GeoFirestoreQuery has loaded and fired all other events for initial data');
});
const onKeyEnteredRegistration = this.geoQuery.on('key_entered', (key, location, distance) => {
console.log('key_entered');
console.log(key, location, distance);
this.publications.push({ key: key, coords: { lat: location[0], lng: location[1] }, distance: distance });
});
const onKeyExitedRegistration = this.geoQuery.on('key_exited', (key, location, distance) => {
console.log('key_exited');
console.log(key, location, distance);
});
const onKeyMovedRegistration = this.geoQuery.on('key_moved', function (key, location, distance) {
console.log('key_moved');
console.log(key, location, distance);
});
}
On every callback you have access to
- document key
- geopoint
- distance
Sorry I am not at pc right now, so believe things like formatting might be wrong
from geofirestore-js.
@akaisuicchi , you pretty much got it on point.
@Morzilla You're the second person to bring up how it's difficult to follow without an example application. So I'm actually working on one for version 2.0.0. I will be closing this issue (because of the answer above, and this isn't really an issue, more of a question).
Considering it is just an implementation question I'm curious if anyone has thoughts as to wether a gitter or stack overflow tag would be appropriate for things like this moving forward?
from geofirestore-js.
@akaisuicchi Thank you, i did it with the "key_entered" event (I have the user's uid in the GeoFirestore reference document).
@MichaelSolati Maybe you could add just a couple of examples, like the one I asked, just to give a "starting point" for a new user like me, and yes, it could be the right way to use SO for questions/problems and GH for issues only...
Again, thanks both for your kindness!
from geofirestore-js.
@MichaelSolati a SO tag might be better but gitter could be too.
Questions and doubts for SO and real issues or improvements for GH is what other people/projects try to do.
from geofirestore-js.
Related Issues (20)
- Question - how can I find near documents with each unique radius? HOT 11
- How to write to firestore after geofirestore query HOT 1
- can't write to firestore properly after geofirestore query HOT 1
- StartAt or startAfter support HOT 1
- Query speed HOT 6
- Custom document key HOT 1
- Geoqueries with additional queries? HOT 3
- When querying `near`: `distance` prop is missing when distance is 0 HOT 1
- Support for Firebase JS SDK 9 HOT 9
- customKey not working on read HOT 10
- Pass a custom document ID HOT 1
- Query returning zero results when filtering with where HOT 8
- Support for new firestore 9.x? HOT 1
- runTransaction on a collection (server-side using cloud functions) HOT 1
- firebase geofirestore v9 not working HOT 1
- Bug double removed on a marker HOT 1
- Geofirestore and onSnapshot are giving delayed events - information is not updating properly
- Unsubscribe from GeoQuery.onSnapshot on document deletion HOT 1
- Typescript errors when trying to deploy function HOT 2
- Is there a way to update the criteria of GeoQuery ? Rather then making a new one
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geofirestore-js.