openlayers
openlayers copied to clipboard
Style Array - Overlapping Marker Styles
Hi,
currently I am styling my markers using a style array, containing two style objects (the marker itself and an icon).
Depending on the zoom level it happens, that my markers overlap on the map and when this happens, I get the problem as shown in the following screenshot:
The green marker sticks in between the white marker and the white marker's plane icon. How can I avoid that another marker gets drawn in between the styles of a single marker? I assume that manually adjusting the z-layer for each style gets complicated, because it is a problem between different markers. Any ideas?
zIndex can be set in style functions. e.g. use the x coordinate so overlapping features are stacked left to right https://codesandbox.io/s/cluster-forked-u14rwm?file=/main.js