I am having a Google Map with lots of markers added using websockets. I am using custom marker images based on data availability. I want to make sure the newest marker stays
Problem solved. Just set the zValue to 999 (I'm guessing higher will bring it more to the top) and it should come to the top. I guess the default is below 999:
var zValue;
if (someCondition) {
zValue = 999;
}
var marker = new google.maps.Marker({
map: map,
position: {lat: lat, lng: lng},
title: titleString,
icon: image,
zIndex: zValue
});