Google Maps API v3 SVG markers disappear

I had the same problem using png markers icons for markers, some times after fitBounds (some markers disappears and they appear when I zoom-in) and only dissappears if I make this markers draggables.

I tried this:

map.panTo(map.getCenter()); 

after setting markers draggables. And now it works fine.

It seem a bug on the V3 implementation.


Works for me, tested with Chrome (Windows) Version 26.0.1410.64

However, few things to try out:

  • Remove marker zIndex, you are purposely trying to hide it under? see: zIndex -20
  • Remove fillOpacity
  • You said that moving map brings it to visible? You are already doing map.setCenter(); but its not enough? you could alternatively trigger one of the map events when you add marker so you dont need to move it, like : google.maps.event.trigger(map, 'drag');
  • What if you store all markers inside array and loop them through when new one is added? and trigger their google.maps.event.trigger(marker, 'icon_changed');
  • Use pngs with same code and see if problem is with svg only

Here is JS fiddle where I tried some of these things.

Edit:

After several tests I noticed that using map.panTo(latLng); instead of map.setCenter(latLng); makes SVG markers to draw correctly. Alternatively, if you dont want to pan to center, using map.panBy(x, y); as 1 pixel and then back to previous center (fast) might have similar effect of solving this problem.

Here is JS fiddle to see that in action.