Here is a code snippet which explains how to remove annotations from mapview using Titanium.
//Define the current window
var currentWin = Ti.UI.currentWindow;
//Define the resource directory
var resDir = Ti.Filesystem.getResourcesDirectory()
//Define a map
var myMapView = Titanium.Map.createView({
top : 0,
height : ( Ti.Platform.displayCaps.platformHeight / 4 ) * 3, //Define the height of the map
mapType : Titanium.Map.STANDARD_TYPE, //Map type that will be displayed
region : { // define the region that will be centered on the map
latitude : 20.06667, //Define the latitude point of that region
longitude : 85.83333, //Define the longitude point of that region
latitudeDelta : 0.5, //North to South distance displayed in decimal degrees
longitudeDelta : 0.5 //East to West distance displayed in decimal degrees
},
animate : //Map region animated
regionFit : true, //Fits the aspect ratio
userLocation : false //To display user location
});
//Map added to window
currentWin.add(myMapView);
//Define first annotation
var annotation1 = Titanium.Map.createAnnotation({
latitude: 20.462521,
longitude: 85.8829895,
title: 'Cuttack',
subtitle: 'Place1',
animate:true,
id: 1,
pincolor: Titanium.Map.ANNOTATION_GREEN
});
//First annotation added to the mapview
myMapView.addAnnotation(annotation1);
//Define second annotation
var annotation2 = Titanium.Map.createAnnotation({
latitude: 19.8133822,
longitude: 85.8314655,
title: 'Puri',
subtitle: 'Place2',
animate:true,
id: 2,
pincolor: Titanium.Map.ANNOTATION_PURPLE
});
//Second annotation added to the mapview
myMapView.addAnnotation(annotation2);
//Define a button
var clearBtn = Ti.UI.createButton({
width : 100,
height : (Ti.Platform.displayCaps.platformHeight / 4),
bottom : 0,
title : 'Clear Annotations'
});
//Button added to the window
currentWin.add(clearBtn);
//Event to remove annotations
clearBtn.addEventListener('click', function(){
//To remove particular annotation
myMapView.removeAnnotation(annotation2); //Second annotation removed
//To remove all annotations
myMapView.removeAllAnnotations();
});
NOTE : Tested in Android device