Hey, I just finished creating a Google map in real time using firebase and GeoFire. GeoFire is really cool and easy to use. It allows you to query using lon lat and radius. It returns a key that you can use to query your firebase database. You set the key while you create the geoFire object to be what you want. This is usually a link that you can use to get the object associated with this distance.
Here is the link to geoFire: https://github.com/firebase/geofire-js
Here is a usage example:
You have lon lat, which you use with the navigator:
var lon = '123.1232'; var lat = '-123.756'; var user = { name: 'test user', longitude: lon, latitude: lat } usersRef.push(user).then(function(response) { var key = response.key; var coords = [lon, lat]; geoFire.set(key, coords, function(success){ console.log('User and geofire object has been created'); }); })
Now you can query the user using:
If you use google maps. I recommend you use angular -google-maps. This is a really cool Google Maps directive that uses an array of markers and circles. Therefore, when the variables $ scope.markers or $ scope.circles change in the controller, it will automatically be applied to the map without any dirty code. They have very good documentation.
Here is the link: http://angular-ui.imtqy.com/angular-google-maps/
source share