setStyle method
Updates the map's Mapbox style object with a new value.
If a style is already set when this is used and options.diff is set to true, the map renderer will attempt to compare the given style against the map's current state and perform only the changes necessary to make the map style match the desired state. Changes in sprites (images used for icons and patterns) and glyphs (fonts for label text)////// cannot** be diffed. If the sprites or fonts used in the current style and the given style are different in any way, the map renderer will force a full update, removing the current style and building the given one from scratch.
@param style A JSON object conforming to the schema described in the
Mapbox Style Specification, or a URL to such JSON.
@param {Object} options
@param {boolean} options.diff=true
If false, force a 'full' update, removing the current style
and building the given one instead of attempting a diff-based update.
@param {string} options.localIdeographFontFamily='sans-serif'
Defines a CSS
font-family for locally overriding generation of glyphs in the 'CJK Unified Ideographs', 'Hiragana', 'Katakana' and 'Hangul Syllables' ranges.
In these ranges, font settings from the map's style will be ignored, except for font-weight keywords (light/regular/medium/bold).
Set to false
, to enable font settings from the map's style for these glyph ranges.
Forces a full update.
@returns {MapboxMap} this
@example map.setStyle("mapbox://styles/mapbox/streets-v11");
@see Change a map's style
Implementation
MapboxMap setStyle(dynamic style, [dynamic options]) =>
MapboxMap.fromJsObject(jsObject.setStyle(style));