map-gl-utils icon indicating copy to clipboard operation
map-gl-utils copied to clipboard

Support changing style while keeping custom base layers

Open stevage opened this issue 6 years ago • 2 comments

This might look like:

map.U.setStyle('mapbox://mapbox.blah', { discardRegex: 'mapbox://' })

Then:

  1. Fetch new style
  2. Find every source in current style whose URL doesn't match the discardRegex, add it to the new style
  3. Find every layer in current style belonging to a retained source, copy over`

Alternative:

map.U.checkpointStyle("beforeLoaded");

map.U.setStyle('mapbox://mapbox.blah', 'beforeLoaded`);

That is, define a name for this point in the style, and allow operations to diff between points.

stevage avatar Jul 10 '19 01:07 stevage

Or something like this: https://github.com/mapbox/mapbox-gl-js/issues/2268#issuecomment-401979967

vinayakkulkarni avatar Mar 23 '20 07:03 vinayakkulkarni

Just mulling over some more ideas here. A few possible design goals:

  • more elegant way of loading a basemap and manipulating it, in one go. (ie, load style from server, but add additional layers, without having to wait for a map render between the two steps)
  • make it easy to switch basemaps while retaining other layers
  • make it easy to specify how custom layers sit within a basemap (eg, "below first symbol layer")

stevage avatar Apr 15 '21 13:04 stevage