stevage / map-gl-utils

A utility library that makes Mapbox GL JS or Maplibre GL a bit more convenient to work with.
https://npmjs.com/package/map-gl-utils
212 stars 24 forks source link

Support changing style while keeping custom base layers #4

Open stevage opened 5 years ago

stevage commented 5 years ago

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.

vinayakkulkarni commented 4 years ago

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

stevage commented 3 years ago

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