Mapbox-gl-native: Layers disappear after style change

Created on 16 Jan 2018  路  1Comment  路  Source: mapbox/mapbox-gl-native

*Platform:Android*
*Mapbox SDK version:5.3.1*

Steps to trigger behavior

  1. Add any Layer by:
    map.addSource(source);
    map.addLayer(layer);
    Layer is displaying.
  2. Now change mapStyle:
    for example:
    mapboxMap.setStyleUrl(Style.SATELLITE);

Expected behavior

Everything displaying correct.

Actual behavior

Actually map doesn't display layers added before style changing.

Current solution for me is to remove layers before style change and add them after this operation.

Android

Most helpful comment

@2Rec there seems to be a misconception from your end. Style is the root component and adding Layers/Sources to MapboxMap will add them to the loaded style. If you load a new style, you will have to recreate your layers and sources and add them agian.

Actual behaviour is a work as designed, UX improvements around this will be done in https://github.com/mapbox/mapbox-gl-native/issues/9338.

>All comments

@2Rec there seems to be a misconception from your end. Style is the root component and adding Layers/Sources to MapboxMap will add them to the loaded style. If you load a new style, you will have to recreate your layers and sources and add them agian.

Actual behaviour is a work as designed, UX improvements around this will be done in https://github.com/mapbox/mapbox-gl-native/issues/9338.

Was this page helpful?
0 / 5 - 0 ratings