Hey I am using the two packages dburles:maps
and mdg:geolocation
and my goal is to plot the current location on a map. This is my current JS code which display's a map, but I am not sure how to proceed with it.
map.js EDITED
Meteor.startup(function() {
GoogleMaps.load();
});
Template.map.helpers({
mapOptions: function() {
if (GoogleMaps.loaded()) {
return {
center: new google.maps.LatLng(current),
zoom: 8
};
}
}
});
Template.map.onCreated(function() {
GoogleMaps.ready('map', function(map) {
if (navigator.geolocation) {
// Support
navigator.geolocation.getCurrentPosition(function(position) {
var current = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
});
map.setCenter(current);
} else {
// No support
console.log("Something is wrong!")
}
})
})
I think I am supposed to add something in the if(navigator.geolocation
and then place the value in the center: new google.maps.LatLng()
, but not sure. Any ideas?