android - jQuery UI Map Current Position Marker with Accuracy -
is possible in phonegap application using jquery ui map, set current position blue dot blue radius around accuracy happens native google maps application in android ?
if so, how can achieve that
found work around create circle overlay accuracy value found inside position object
here full code (don't forget add reference file jquery.ui.map.overlays.js)
function locsuccess(position) { //set current position google maps object var newpoint = new google.maps.latlng(position.coords.latitude, position.coords.longitude); //get marker current position var mypos = $('#map_canvas').gmap('get', 'markers')['mypos']; //if there no marker (first time position) if(!mypos) { //create new marker $('#map_canvas').gmap('addmarker', { 'id':'mypos', 'position':newpoint, 'icon' : 'http://maps.google.com/mapfiles/ms/icons/blue-dot.png' }); //create accuracy circle $('#map_canvas').gmap('addshape', 'circle', { 'strokecolor': "#86a9f4", 'strokeopacity': 0.85, 'strokeweight': 2, 'fillcolor': "#c2d0f1", 'fillopacity': 0.25, 'center': newpoint, 'radius': position.coords.accuracy }); } else { //if there marker, update position mypos.setposition(newpoint); //update circle radius , position (i have 1 circle, code should improved) var circlepos = $('#map_canvas').gmap('get', 'overlays > circle')[0]; circlepos.setcenter(newpoint); circlepos.setradius(position.coords.accuracy); } $('#map_canvas').gmap('refresh'); }
Comments
Post a Comment