-
Notifications
You must be signed in to change notification settings - Fork 916
Map.clear()
Remove all mark-ups, such as marker.
###Description Removes all markers, polylines, polygons, overlays, etc from the map.
Important! This method does not remove event listeners.
You need to call map.off() separately if you want to reset.
###Code
map.getVisibleRegion(function(latLngBounds) {
var sw = latLngBounds.southwest;
var ne = latLngBounds.northeast;
var diffY = (ne.lat - sw.lat);
var diffX = (ne.lng - sw.lng);
for (var i = 0; i < 10; i++) {
var latLng = new plugin.google.maps.LatLng(sw.lat + diffY * Math.random() , sw.lng + diffX * Math.random());
map.addMarker({
'position': latLng
}, function(marker) {
map.on("test", function() {
alert("test");
});
});
}
});
$("#clearBtn").click(function() {
map.clear();
map.off();
map.trigger("test");
});If you get an error, feel free to ask me on the official community or the issue list.
New version 2.0-beta2 is available.
The cordova-googlemaps-plugin v2.0 has more faster, more features.
https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/tree/master/v2.0.0/README.md
New versions will be announced through the official community. Stay tune!
Feel free to ask me on the issues tracker.
Or on the official community is also welcome!
New version 2.0-beta2 is available.
The cordova-googlemaps-plugin v2.0 has more faster, more features.
https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/tree/master/v2.0.0/README.md
.gif)