javascript - Getting current location on a map using Meteor -


hey using 2 packages dburles:maps , mdg:geolocation , goal plot current location on map. current js code display's map, not sure how proceed 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 wrong!")     }    }) }) 

i think supposed add in if(navigator.geolocation , place value in center: new google.maps.latlng(), not sure. ideas?

you're on right track. have seen google's geolocation example?


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -