0

Currently I have the following node 'Zones' in firebase, which means the zones of the parking lot: enter image description here

In this object I must save an object that is called 'parking', that object must contain the properties of lat, long and geohash given by the GeoFire.Set library. I currently keep it in this way separately: enter image description here

 var firebaseRef = firebase.database().ref('zona');
  var geoFire = new GeoFire(firebaseRef);
          geoFire.set("some_key9", [37.79, -122.41]).then(function() {
              //console.log("Provided key has been added to GeoFire");
            }, function(error) {
              //console.log("Error: " + error);
            });

How can I make the 'zone' node save what I send in geoFire.set newer property so that it looks like this:

zona_parqueo1:{
    g: "9q8yyrry8q",
    l:{
      0: 37.79,
      1: -122.41
    },
    parqueos: {
      parqueo1: {
       'nombre': 'parqueo1'
      },
      parqueo2: {
       'nombre': 'parqueo2'
      }
    }

Likewise I use the 'on' method to obtain the values ​​and create a marker with latitude and longitude:

geoQuery.on("key_entered", function(key, location, distance) {
              //console.log(key + " entered query at " + location + " (" + distance + " km from center)");
              //console.log("LATITUD Y LONGITUD");
              console.log(location);

              let marker = {
                lat: location[0],
                lng: location[1]
              }

             vm.markers.push(marker);

           });
        },
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
JG_GJ
  • 755
  • 1
  • 10
  • 33
  • 1
    That's not currently possible in Geofire for JavaScript. You'll instead store the properties in a separate top-level node, using the same keys that you use in Geofire. See https://stackoverflow.com/questions/38340949/how-to-save-geofire-coordinates-along-with-other-items-in-firebase-database – Frank van Puffelen Feb 06 '19 at 19:02
  • please can you help me by applying it to my code, thank you very much. – JG_GJ Feb 07 '19 at 15:36

0 Answers0