I am setting number of markers(using png icons) on gmap at the same time but when I update the list the markers should be updated accordingly.
But they didn't gets updated immediately with the list.
First I am clearing the map from markers with this code
for (var i=0; i<this.markerList.length; i++) {
this.markerList[i].setMap(null);
}
// Reset the markers array
this.markerList = [];
Than I am setting the markers again with my initial code which run at the time of mounted
this.markers = this.mappedListings;
this.markerList = this.markers.map((home) => {
var price = home.info.listingPrice
var favList = this.getFavIconOnMap(home);
var url = this.setMarkerIcon(home,favList);
var homeInfo = home.info;
let marker = new this.google.maps.Marker({
position: {
lat: parseFloat(home.position.lat),
lng: parseFloat(home.position.lng),
},
scaledSize: new this.google.maps.Size(18, 18),
icon: url,
label: { color: '#FFFFFF', fontWeight: 'bold', fontSize: '10px', text:String(price)}
});
I am changing the image url by these conditions
var url=''
if(home.info.status === "CT" && favList == false){
url = new google.maps.MarkerImage(
'/assets/icons/contigment.png',
new google.maps.Size(108, 120), //adjust size of image placeholder
new google.maps.Point(-25, -27), //origin
new google.maps.Point(-69,0) //anchor point
);
}
else if(home.info.status === "CT" && favList == true){
url = new google.maps.MarkerImage(
'/assets/icons/contigmentheart.png',
new google.maps.Size(108, 120), //adjust size of image placeholder
new google.maps.Point(-25, -27), //origin
new google.maps.Point(-69,0) //anchor point
);
}
The First Problem is
When I update values in my marker gets updated but there is no change on map until I zoom in or zoom out the map. I Tried every function at the time of updating which I using in my app.
The Second Problem is
When marker updates after zoom in or zoom out of map , then after two three times of update it shows previous marker behind the current marker on map, don't know how it is showing double marker for the same although I empty map every time.
Here is the first picture of marker before updating.
Here is the Second Picture after updated values.
Again when I change List to previous values, according to logic there should be first image but behind this it is showing a part of second image also, as you can see in image below
Not so familiar with gmaps, hope I elaborate the problem clearly.


