Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Layer Index Is Ignored #14378

Closed
bwuso opened this issue Apr 9, 2019 · 1 comment
Closed

Layer Index Is Ignored #14378

bwuso opened this issue Apr 9, 2019 · 1 comment
Labels
Android Mapbox Maps SDK for Android

Comments

@bwuso
Copy link

bwuso commented Apr 9, 2019

Adding a layer using the Style.addLayerAbove, Style.addLayerBelow, Style.addLayerAt does not affect the map layer order.

This happened after upgrading the SDK from 5.4.1 to 7.4.0-Alpha (needed fix for disabling binaries).

This only happens on 7.4.0-Alpha builds

Steps to reproduce

  1. Instantiate Mapbox and have style load with a base "custom-satellite" layer.
  2. Add Layer 1's source to the style via style.addSource.
  3. Add Layer 1 to the style via style.addLayerAfter(layer1, "custom-satellite").
  4. Add Layer 2's source to the style via style.addSource.
  5. Add Layer 2 to the style via style.addLayerBefore(layer2, layer1.getId());.

Expected behavior

Layer 2(the b/w satellite imagery) should be beneath Layer 1 (orange boundary line).
expected

Actual behavior

Layer 2(the b/w satellite imagery) is on top of Layer 1 (orange boundary line).
actual

Configuration

Android versions: 7.1.2
Device models: Google Pixel
Mapbox SDK versions: 7.4.0-alpha.1

Workaround

  1. Call addLayer on Layer 2 before adding Layer 1.

or

  1. Remove Layer 1
  2. Remove Layer 1's Source (important)
  3. Add Layer 1's Source (important)
  4. Add Layer 1

Debugging

While debugging this during the add step. A call to nativeMap.getLayers() revealed that it was adding the layers at least in the right index. Here is the ordered list of getId() on the layers.

1. satellite
2. satellite_carousel_image - (Layer 2)
3. orange_boundary_id - (Layer 1)
4. com.mapbox.annotations.point
5. mapbox-android-symbol-layer
6. mapbox-location-shadow-layer
7. mapbox-location-accuracy-layer
8. mapbox-location-background-layer
9. mapbox-location-foreground-layer
10. mapbox-location-bearing-layer

Other Possible Related Issues

I suspect that this is also connected to other issues in our app with LocationComponent's user location marker and any markers made with SymbolManager's .create.

Image showing location component's marker underneath the drawn boundary layers.
location_component

Image showing the marker is covered by the layers even though the layers are under the symbol and annotations layers.
marker

@bwuso bwuso changed the title Layer Priority Order Is Ignored Layer Index Is Ignored Apr 9, 2019
@LukasPaczos LukasPaczos added the Android Mapbox Maps SDK for Android label Apr 10, 2019
@bwuso
Copy link
Author

bwuso commented Apr 12, 2019

Fixed by #14408

@bwuso bwuso closed this as completed Apr 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

2 participants