Repository navigation
Description
migrated from mapbox/DEPRECATED-mapbox-gl#25 by @lucaswoj
- SetStyle on map with multiple layers #2267
- Changing map style remove its data #2144
- "icon-image": "{marker-symbol}-15" doesn't work for dynamic js markers when adding it to a satellite map #1878
...
Users don't expect setStyle to overwrite everything, and consider the current behavior a bug. This is a bummer, and something that we could document around, saying "setStyle will wipe out the current state of the map". I'm fine with the documentation approach, but it needs a workaround, because "switching the map style" is a common usecase that is a hard expectation - it's easy to do in Leaflet and all similar tile-based libraries. -- @tmcw, 2016
Injecting custom layers into Mapbox core styles is a common use case and confusing to our users, especially when the user wants to swap out the core style and keep the custom layers.
Have we considered supporting "nested styles"? These would help our users build a solid mental model of their stylesheet, encapsulate core style implementation details, allow new kinds of style modularity, and fit nicely into Studio.
map.setStyle({
version: 9,
layers: [{
type: 'style',
layout: { url: 'mapbox://styles/mapbox/streets-v9-bottom' }
}, ..., {
type: 'style',
layout: { url: 'mapbox://styles/mapbox/streets-v9-top' }
}]
});
Activity
mb12 commentedon Jan 18, 2017
An alternative option would be to add a separate API to add points, lines and polygons. These could be internally persisted by GL JS automatically via an implicit source. GL native already supports this for feature parity with Mapkit.
jaapster commentedon Sep 8, 2017
@lucaswoj Could these style-layers be added dynamically? That would be very helpful.
In our product we have a base "meta-layer", typically something like "streets-v9", containing multiple "mapbox layers" and on top of that we load our own dynamically generated "meta-layers" (containing tile sources and "mapbox layers") and GeoJSON layers for rendering of selection, drawing etc.
This combined with inline base64 encoded icons would be awesome ...
miguelleitevieira commentedon Jan 24, 2018
Hi all, exist some developments on this feature?
santinogue commentedon Jan 29, 2018
Hi, any updates on this???
stevage commentedon Jul 12, 2019
Is this essentially a duplicate of #4225?
kkaefer commentedon Mar 8, 2024
We support style imports now.
JamesChevalier commentedon Mar 8, 2024
Your link goes to an internal repository. Is this the feature you’re referring to?
https://docs.mapbox.com/style-spec/reference/imports/