OverlappingMarkerSpiderfier icon indicating copy to clipboard operation
OverlappingMarkerSpiderfier copied to clipboard

addMarker insert order is not preserved with OverlappingMarkerSpiderfier

Open phlegx opened this issue 7 years ago • 3 comments

Hi!

If I use the map and load my markers without OverlappingMarkerSpiderfier the order of inserted markers is preserved. With OverlappingMarkerSpiderfier the addMarker seams to shuffle the order.

Why? How can I solve this problem?

phlegx avatar Jul 10 '17 13:07 phlegx

I'm not sure what you mean by the order of the markers. Can you clarify? What problem is being caused? Screenshots or code samples might help.

jawj avatar Jul 10 '17 15:07 jawj

Hi @jawj! Example: All markers are in an ordered Array and all markers overlap's. I have two types of markers: red and green. The red markers are always at the beginning of the array. If I loop trough the array to add the marker to the map (normal Google Maps add marker function), the most upper marker is still green, because it is the last marker in the array. Until here all works fine but if I loop the same way over the array to add the marker to the OverlappingMarkerSpiderfier layer, the maps shows me some time a green marker and some times a red marker on top of overlapped markers. Why?

phlegx avatar Jul 10 '17 17:07 phlegx

In general, the markers shown on top should be the ones lower down the screen (i.e. at lower latitude), and only in the case of a tie (i.e. identical latitudes) would I expect indeterminate results.

Your problem sounds like a Z index issue, but OMS only touches the Z indices when spiderfying, and restores them straight after.

I would need to see working examples both ways (with and without OMS in use) to investigate further. A service like JSFiddle might be useful to you here.

jawj avatar Jul 11 '17 08:07 jawj