mapbox-gl-js icon indicating copy to clipboard operation
mapbox-gl-js copied to clipboard

Is there a way to toggle the style smoothly?

Open ZhenanH opened this issue 10 years ago • 4 comments

the 'setStyle' method remove the old style with layers, so it does't feel smooth when switching styles. What't the best way to switch styles for example between 'street-v9' and 'outdoors'?

thanks

ZhenanH avatar Jul 06 '16 02:07 ZhenanH

Use mapbox-gl-style diff https://github.com/mapbox/mapbox-gl-style-spec/blob/mb-pages/API.md#diffstylesbefore-after

jingsam avatar Jul 06 '16 05:07 jingsam

Yep, that's the best way currently. See #1989 for other plans.

jfirebaugh avatar Jul 06 '16 15:07 jfirebaugh

Hi thanks for the reply, but I am not sure how exactly to do that, could you give me an example? thanks in advance!

ZhenanH avatar Jul 08 '16 03:07 ZhenanH

For example, https://www.mapbox.com/mapbox-gl-js/example/setstyle/ the toggle doesn't feel smooth at all

ZhenanH avatar Jul 08 '16 04:07 ZhenanH