Giter VIP home page Giter VIP logo

Comments (4)

tsuginodan avatar tsuginodan commented on May 31, 2024 2

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.

MichaelSolati avatar MichaelSolati commented on May 31, 2024 1

@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.

Morzilla avatar Morzilla commented on May 31, 2024 1

@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.

tsuginodan avatar tsuginodan commented on May 31, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.