I have this code:
function startTracking() {
var trackId = navigator.geolocation.watchPosition(successCallback, null, {maximumAge:1000, timeout:60000, enableHighAccuracy:true});
function successCallback(position){
map.panTo(new google.maps.LatLng(position.coords.latitude, position.coords.longitude));
var marker = new google.maps.Marker({
position: new google.maps.LatLng(position.coords.latitude, position.coords.longitude),
map: map,
title: 'Posizione Attuale'
});
marker.setMap(map);
};
}
Now the app create a marker every time that I move. I would like that, on the map, I see only the marker where I'm in that moment, I won't see the marker on the previous position.
Insert a button for refresh and solve the problem..