I am using Ionic 3 with @ionic-native/google-maps (https://github.com/ionic-team/ionic-native-google-maps/blob/master/documents/README.md).
I am using markerCluster to populate the map with markers.
At the moment, to update the markers, I am performing a map.clear()
, as it can be seen in the code below.
The problem I have is that the markers are "flashing" when the map is clearing and the new one are created. By "flashing", I am trying to say that you can see how it disappears and appears again.
Is there a way to remove a marker from markerCluster
, instead of clearing the map?
I am using this code to show on map some locations with some updates.
E.g.:
- the pin is green if available
- the pin is blue if in used
- remove pin if offline
So, I am calling the WS to get the status every few seconds and update the pins icons based on the status.
I have tried markerCluster.remove()
, instead of map.clear()
, but the pin is not removed from the map.
this.map.clear();
markerCluster = this.map.addMarkerClusterSync({
markers: this.markers,
icons: [
{
min: 2,
max: 9,
url: this.assetsPath + "images/pin_cluster.png",
label: {
color: "black",
fontSize: 15,
},
size: { width: 40, height: 40 }
}],
boundsDraw: false
});