1

I initially used an InfoBox to create a label for a marker with a custom icon. For the scenario of overlapping markers, the labels became illegible and so I had to look for a solution or alternative.

It was suggested in a previous question that I should make use of MarkerWithLabel. It definitely helps, but if the markers overlap exactly, you can see the label still coming through even after setting the opacity to 1 and making the background the same as the custom marker.

enter image description here

.labels {
    background-color: #FF5959;
}

gmarker = new MarkerWithLabel({
    position: someCenterPosition,
    icon: customImageURL,
    draggable: false,
    raiseOnDrag: false,
    map: map,
    title: someTitle,
    labelContent: aTitle,
    labelAnchor: new google.maps.Point(someOffsetX, someOffsetY),
    labelClass: "labels", // the CSS class for the label
    labelStyle: {opacity: 1}
});

The 2 is actually the marker behind's label and 15 should be displayed on the front marker. I need to have the 2 and its background behind the marker with the label of 15.

Community
  • 1
  • 1
sim1
  • 457
  • 1
  • 7
  • 26
  • See the fix in the related question: [Google maps Marker Label with multiple characters](http://stackoverflow.com/questions/32467212/google-maps-marker-label-with-multiple-characters) (append the label to the `markerLayer` rather than the `overlayImage`) – geocodezip Feb 05 '16 at 22:28
  • @geocodezip, I had a look and my version of markerwithlabel already includes that fix - so it does not fix this issue. For slightly overlapping markers, the labels react fine, but the issue arises when they overlap almost exactly. – sim1 Feb 07 '16 at 20:06
  • @geocodezip, so it looks like manipulating the zIndex solves this issue if there is no other way. – sim1 Feb 07 '16 at 20:32
  • @sim1 how did you solve this issue with zIndex. Can you explain where you changed the zIndex? I've tried changing it in many places to no avail. I am having the same overlapping issue when markers are close to each other. Thanks. – thienedits Jan 11 '17 at 02:27

0 Answers0