Hi there !
I’ve got some issue trying to remove all my google maps markers when doing some actions.
So, i have 3 types of markers on my map : markers for friends, a marker for my position and markers for points of interest.
I need to see my position anytime, so my_position marker has a specific title => “my_position”.
But when I need to remove my points of interest markers or my friends markers, i can’t remove them all doing this:
for (let i = 0; i < this.markers.length; i++) {
if(this.markers[i].title !== 'my_position') {
this.markers[i].setMap(null);
this.markers.splice(i, 1);
}
}
For the friends markers, sometimes it works, sometimes it doesn’t.
And for the points of interest markers (there is 3 of them), one of them is always there and i don’t know how to remove it.
If you need more code or have any questions, feel free to ask.
Thanks !