jQuery UI Map を使用する PhoneGap アプリケーションで、現在の位置を、Android のネイティブ Google Maps アプリケーションで発生する精度のために、周囲に青い半径を持つ青い点として設定することは可能ですか?
もしそうなら、どうすればそれを達成できますか
jQuery UI Map を使用する PhoneGap アプリケーションで、現在の位置を、Android のネイティブ Google Maps アプリケーションで発生する精度のために、周囲に青い半径を持つ青い点として設定することは可能ですか?
もしそうなら、どうすればそれを達成できますか
位置オブジェクト内で見つかった精度値で円オーバーレイを作成することで回避策を見つけました
完全なコードは次のとおりです (このファイル jquery.ui.map.overlays.js への参照を追加することを忘れないでください)。
function locSuccess(position) {
//Set the current position as a Google Maps object
var newPoint = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
//Get the marker with the current position
var myPos = $('#map_canvas').gmap('get', 'markers')['myPos'];
//If there is no marker (first time position)
if(!myPos) {
//Create a new marker
$('#map_canvas').gmap('addMarker', {
'id':'myPos',
'position':newPoint,
'icon' : 'http://maps.google.com/mapfiles/ms/icons/blue-dot.png'
});
//Create the 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 is already a marker, update the position
myPos.setPosition(newPoint);
//Update the circle radius and position (I only have 1 Circle, but this code should be improved)
var circlePos = $('#map_canvas').gmap('get', 'overlays > Circle')[0];
circlePos.setCenter(newPoint);
circlePos.setRadius(position.coords.accuracy);
}
$('#map_canvas').gmap('refresh');
}