ThinkGeo.com    |     Documentation    |     Premium Support

Overlay order inconsistency

Hi ThinkGeo

I’m curious as to how the order in the Overlays collection correspond to the order the overlays are drawn.

My expectation was that index 0 in the Overlays is drawn as the bottom overlay, index 1 the overlay above it and so forth.
This also seems to be the case, except for the marker overlays - for those it seems to be the other way around.
Like if all the marker overlays are put in a separate list with a reverse order.

We show a list of all the overlays to the user that he can manipulate in various ways, and its inconvenient that marker overlays needs this special attention.

Seen in 9.0.0.175 and 9.0.309.0

Best regards
Jonas

Hi Jonas,

The WPF Edition draws the overlays by descending. For example, the overlay at index 1 is drawn before the overlay at index 0 and there is no special list for maker overlays.

There are two main reasons for this:

  1. The overlay at index 1 has a higher z-index than the overlay at index 0 and so forth, it means that the overlay at index 1 shows above the overlay at index 0. In order to get the good experience, the index 1 is drawn first.

  2. Usually, the overlay at index 0 has the larger data than the overlay at index 1 to render, it means that the overlay at index 0 needs more time than index 1 to render. When the overlay at index 0 is drawn the UI thread will be blocked for drawing the other overlays. We can guess this should be a bad experience.

If there is something misunderstood here, please let me know.

Thanks,
Peter

Hi Peter
Thanks for your answer. I think I confused you with “the order the overlays are drawn”. What I mean is that the Z-index of an overlay seems to correspond to the index of the overlay in the Overlays collection. Index 0 is the bottom overlay, index 1 is directly above it etc. Except that the Marker overlays reverse this logic. If I have two marker overlays in index 2 and 3 in the Overlay collection, 2 will be shown above 3.

Example:

Overlay collection:
0: OpenStreetMapOverlay
1: LayerOverlay with shapefile
2: MarkerOverlay1
3: MarkerOverlay2

Display order:
OpenStreetMapOverlay (bottom)
LayerOverlay with shapefile
MarkerOverlay2
MarkerOverlay1 (top)

Best regards
Jonas

Hi Jonas,

Thanks for more information.

In Wpf Edition the Marker Overlay and the Popup Overlay has the higher index than the others, no matter what the order of them, they always at the top of the Map, because we can interact with them.

Hope it’s helped.

Thanks,
Peter

Hi again

I don’t think you read my post to the end.

I understand that the marker overlays are on top of the other overlays, but that is not my point.

My point is that they are displayed in opposite order.

Imagine this WpfMap.Overlays collection:
Index 0: MarkerOverlay0
Index 1: MarkerOverlay1

I would expect MarkerOverlay1 to be displayed above MarkerOverlay0. Quoting your first response in this thread:
“the overlay at index 1 shows above the overlay at index 0”.

But this is how they are actually displayed:

MarkerOverlay1 (bottom)
MarkerOverlay0 (top)

Notice how the order is opposite the expected.

All other types of overlays (that I have tried) are displayed in the order you describe,
but the marker overlays are displayed in opposite order.

Best regards
Jonas

Hi Jonas,

Sorry for misunderstood here. I recreated this issue. I’ll let our developers know this, and any updates will be updated here.

Thanks,
Peter

Hi Jonas,

This issue has been fixed and it should be available in version 9.0.345.0 or later and 9.0.0.345 or later. Please get it when it’s available and have a try again.

Thanks,
Peter