Currently I have the following node 'Zones' in firebase, which means the zones of the parking lot:
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:
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);
});
},