mapStyle?.addSource(
GeoJsonSource.Builder(SELECTED_ROUTE_MAP_LAYER)
.featureCollection(pushingFeatureCollection).build()
)
mapStyle?.addLayer(createLineLayer(SELECTED_ROUTE_MAP_LAYER))
mapStyle?.removeLayer(SELECTED_ROUTE_MAP_LAYER)
How do I go about removing a layer I added to my mapstyle? I'm using mapbox v10 and removeLayer
does not appear to be an option anymore (Unresolved reference: removeLayer
). I am trying to figure out what the recommened approach is, since the functionallity for adding a layer is the same as previous versions, yet the removal feature appears to be scraped.
Here are the versions I am using:
// MapBox
implementation 'com.mapbox.maps:android:10.15.0'
implementation "com.mapbox.search:mapbox-search-android-ui:1.0.0-rc.6"
I never found a way to remove a layer once it was added, so instead I am using this workaround: