mapbox-gl
3.34.2 · 3 Nov 2026SEE LICENSE IN LICENSE.txt6M / weekRepositoryHomepagenpmAtom feed
197 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 3.x · latest line
3.0.0
29 Nov 2023- breaking
Discontinue WebGL 1 support. WebGL 2 is now mandatory for GL JS v3 usage, aligned with universal browser support.
- breaking
Remove the
optimizeForTerrainmap option (layer rendering on globe and terrain is always optimized now). Introduced a new 3D Lights API that supports directional and ambient light sources to give you control of lighting and shadows in your map when using 3D objects.
Mapbox GL JS v3 enables the Mapbox Standard Style, a new realistic 3D lighting system, building shadows and many other visual enhancements, and an ergonomic API for using a new kind of rich, evolving, configurable map styles and seamless integration with custom data. You can get more information about the new features in the Mapbox GL JS v3 migration guide.
Breaking changes
- breaking
Discontinue WebGL 1 support. WebGL 2 is now mandatory for GL JS v3 usage, aligned with universal browser support.
- breaking
Remove the
optimizeForTerrainmap option (layer rendering on globe and terrain is always optimized now).
Features and improvements
3D Lights
Introduced a new 3D Lights API that supports directional and ambient light sources to give you control of lighting and shadows in your map when using 3D objects.
Add new
*-emissive-strengthproperties for styling layers with the new lighting API.Introduced flood lighting for the extruded buildings' walls and the ground beneath them.
Introduced ambient occlusion to affect the ground beneath the extruded buildings.
Introduced
measureLightexpression lights configuration property: Create dynamic styles based on lighting conditions.Added support for shadows cast from fill extrusions.
Introduced
hslandhslacolor expressions: These expressions allow you to define colors using hue, saturation, and lightness format.Add support for fading out 3D layers in the distance with
fill-extrusion-cutoff-fade-rangeandmodel-cutoff-fade-rangestyle properties.
Style Composition with Imports
Introducing support for nested and configurable styles. You can now import other styles into your main style, with updates to imported styles automatically reflected in your main style. Configuration properties can be set for imported styles, making them customizable.
Introduced concept of
slots, pre-specified locations in the style, where your layer can be added (e.g., on top of existing land layers but below all labels).Introduced
configexpression: Retrieves the configuration value for the given option.When no
styleoption is provided to the Map constructor, the Mapbox Standard Style is now enabled as a default.Add a
style.import.loadevent to track the loading of imported style fragments.
Terrain Improvements
Improve terrain sampling accuracy.
Improve zooming and panning over dynamic terrain so that it feels smooth.
Improve performance for styles that use both hillshade layers and terrain.
New Raster Features
Introduced raster colorization via
raster-colorpaint properties.Introduced
raster-valueexpression: Returns the raster value of a pixel computed viaraster-color-mix.
…and more!
Add support for controlling the vertical fog range with
vertical-rangestyle property.Introduced rounding fill extrusion edges for a smoother appearance.
Introduced the
icon-image-cross-fadeproperty, which controls the transitioning between the two variants of an icon image.Introduced
randomexpression: Generate random values using this expression. Use this expression to generate random values, which can be particularly helpful for introducing randomness into your map data.Introduced
distanceexpression: Returns the shortest distance in meters between the evaluated feature and the input geometry.Add support for elevating symbols over buildings & other 3D layers with
symbol-z-elevatestyle property.Improve rendering of stars on globe view.
Add the
renderstartevent, which, combined with therenderevent, can be used to measure rendering frame duration.Enable zoom-based expressions for model rotation, scale, and translation.
Optimize shader compilation to reduce stuttering on complex 3D styles.
Reduce flickering of symbols along lines due to rounding errors.
Bug fixes
Fix the accuracy of the atmosphere gradient when rendering the globe.
Fix a bug with horizon placement when map
paddingis used.Fix a bug with horizon rendering on Windows/NVidia.
Accessibility fixes: remove
tabindexwhen the map is not interactive; removerole="list"from the attribution control; addrole="img"to markers (h/t @kumiko-haraguchi and @aviroopjana).Fix the order of layers in
queryRenderedFeaturesresults on maps with globe and terrain.Fix an error when zooming out on certain globe views using the GL JS development bundle.
Fix an error on
maphasImageandupdateImageafter the map was removed.Fix rendering of line layers with data-driven
line-border.Fix an issue with symbols sometimes not rendering correctly over the terrain on a top-down view.
Remove duplicate frag precision qualifiers
Changes since
v3.0.0-rc.2Bug fixes
Fix stale source caches in imports on projection change.
Fix style not updating properly when adding new imports.
Fix the breakage of ground effect that occurs when edges cross tile boundaries.
Fix circle layer depth occlusion not working properly with the orthographic camera.
Fix diffing of the styles with imports on
setStyle.Fix GL JS bundle in environments that transpile minified code with async/awaits.
Fix
queryRenderedFeatureswhen the model layer is present in the style.Fix stale 3D lights when removing individually.
Fix source name collision between imports in symbol layers.
Remove duplicate frag precision qualifiers.
- 2.x
2.15.0
25 May 2023Improve performance of symbol layers with identical or no text. Eliminate stuttering when zooming on maps with many identical symbols.
Improve performance of clustered sources: 20% faster loading & 40–60% less memory overhead. Improve performance of symbol collisions.
Add
respectPrefersReducedMotionmap option
Features ✨ and improvements
Improve performance of symbol layers with identical or no text. Eliminate stuttering when zooming on maps with many identical symbols.
Improve performance of clustered sources: 20% faster loading & 40–60% less memory overhead. Improve performance of symbol collisions.
Add
respectPrefersReducedMotionmap optionAdd the
isPointOnSurfacemap method to determine if the given point is located on a visible map surface.
Bug fixes
Fix inconsistent spacing in the Scale control (#12644) (h/t kathirgounder)
Fix tiles preloading when a source is not yet loaded
2.14.0
12 Apr 2023Support
referrerPolicyoption for thetransformRequestfunction when using fetch (#12590) (h/t robertcepa)Enable anisotropic filtering on tiles beyond 20 degrees pitch to prevent it from compromising image crispness on flat or low-tilted maps.
Fix LngLatBounds.extend() with literal LngLat object.
Features ✨ and improvements
Support
referrerPolicyoption for thetransformRequestfunction when using fetch (#12590) (h/t robertcepa)
Bug fixes
Enable anisotropic filtering on tiles beyond 20 degrees pitch to prevent it from compromising image crispness on flat or low-tilted maps.
Fix LngLatBounds.extend() with literal LngLat object.
Add arrow characters to the map of verticalized character (#12608) (h/t kkokkojeong)
Disable panning inertia if
prefers-reduced-motionis enabled
2.13.0
21 Feb 2023Support draping over terrain and globe in CustomLayer API
Improve the rendering performance of terrain slightly by reducing its GPU memory footprint.
Add methods for changing a raster tile source dynamically (e.g.
setTiles,setUrl).
Features ✨ and improvements
Support draping over terrain and globe in CustomLayer API
Improve the rendering performance of terrain slightly by reducing its GPU memory footprint.
Add methods for changing a raster tile source dynamically (e.g.
setTiles,setUrl).
Bug fixes
Fix
line-border-colorwhen used withline-trim-offsetFix potential infinite loop when calling
fitBoundswith globe projectionFix
map.getBounds()returning incorrect bounds with adaptive projections.Introduce skirts for terrain globe mode
Fix blur on draped lines while zoom-in
Fix map pan speed while pinching in
Fix negative-width diacritics handling
Fixes
undefined is not an objectincoalesceChanges(#12497) (h/t nick-romano)
2.12.1
6 Feb 2023Fix a rare bug where certain diacritical characters could break the rendering of a symbol layer.
2.12.0
4 Jan 2023Improve performance of patterns and line dashes and improve their appearance when zooming.
Improve performance of text and icon placement.
Improve performance of loading terrain data
Features ✨ and improvements
Improve performance of patterns and line dashes and improve their appearance when zooming.
Improve performance of text and icon placement.
Improve performance of loading terrain data
Allow zooming towards terrain at a safe distance without pitching the camera
Allow for pitch override in
cameraForBounds,fitBoundsandfitScreenCoordinatescamera APIs.
Bug fixes
Fix
getBoundswhen used around the poles with a globe projection.Fix incorrect transition flag in
*-patternandline-dasharraypropertiesFix symbols filtering when using
center-to-distancealong with terrain.Fix fog rendering artifact on lower resolution terrain tiles
Fix an issue where Geolocate control would throw an error if it's removed before determining geolocation support (#12332) (h/t tmcw)
2.11.1
6 Dec 2022Fix support for line breaks in labels that follow line geometries
2.11.0
14 Nov 2022Add support for
cameraForBoundswith globe projectionAdd support for
fitBoundsandfitScreenCoordinateswith globe projectionImprove support for
getBoundswith globe projection.
Features ✨ and improvements
Add support for
cameraForBoundswith globe projectionAdd support for
fitBoundsandfitScreenCoordinateswith globe projectionImprove support for
getBoundswith globe projection.Improve symbol placement performance with globe projection
Add new marker styling option
occludedOpacityallowing the user to set the opacity of a marker that's behind 3D terrain (h/t jacadzaca)Cancel
ImageSourceimage request when underlying resource is no longer used (#12266) (h/t maciejmatu)Add object literal support in
LngLatBounds.extend(#12270) (h/t stampyzfanz)Add live performance counters. Mapbox-gl-js v2.11.0 collects certain performance and feature usage counters so we can better benchmark the library and invest in its performance. The performance counters have been carefully designed so that user-level metrics and identifiers are not collected.
Bug fixes
Fix elevation of pole geometry when exaggerated terrain is used
Fix
GeolocateControlsometimes not working in iOS16 WebViewFix map crashing on conformal projections at the south pole
Fix pixel flickering between tiles on darker styles in globe view.
Fix occasional missing tiles at bottom of screen during globe-mercator transition
Fix incorrectly requiring three finger drags to change pitch with cooperative gestures while in fullscreen.
Fix jumping when scrolling with mouse when crossing the antimeridian on projections that wrap.
Fix terrain error being fired when using
map.getStyle()with globe viewFix occasional artifacts appearing in the ocean with terrain or globe enabled.
Fix invalid AABB calculation as part of the globe tile cover
Fix incorrect shading of corners in fill extrusions when ambient occlusion is enabled.
Fix potential performance regression on image source updates
Fix memory leak when removing maps (#12224) (h/t joewoodhouse)
Fix updating marker position when toggling between world copied projections and projections without
Fix missing icons in some styles.
Fix overwriting all feature ids while setting promoteIds on other layers with an object. (#12322) (h/t yongjun21)
Fix cursor returning to original state after a popup with
trackPointeris removed (#12230) (h/t camouflagedName)
2.10.0
23 Aug 2022Add new marker styling option
rotationAlignment: 'horizon'allowing marker rotation to match the curvature of the horizon in globe viewImprove panning precision on Globe View and relax constraints on lower zoom levels
Features ✨ and improvements
Add new marker styling option
rotationAlignment: 'horizon'allowing marker rotation to match the curvature of the horizon in globe viewImprove panning precision on Globe View and relax constraints on lower zoom levels
Add unit option to number-format expression (#11839) (h/t varna)
Add screen reader alert for cooperative gestures warning message.
Improve rendering performance on globe view
Improve tile loading performance on low zoom levels
Improve globe-mercator transition and map load performance with globe projection
Bug fixes
Fix a bug where
idexpression didn't correctly handle a value of 0Fix precision errors in depth pack/unpack
Fix
cooperativeGesturespreventing panning on mobile while in fullscreen.Fix misplaced raster tiles after toggling
setStylewith a globe projectionFix exception on creating map in an iframe with sandbox attribute.
Fix "improve map" link in the attribution to include location even if map hash is disabled
Fix Chrome console warnings about ignored event cancel on touch interactions (#12121) (h/t jschaf)
2.9.2
14 Jul 2022Add a workaround in
ScaleControlto support localization in browsers withoutNumberFormatsupport.Fix
GeolocateControlnot working in Safari.
2.9.1
20 Jun 2022Fix missing lines on some Windows devices.
2.9.0
17 Jun 2022Add
globeprojection. This new projection displays the map as a 3d globe and can be enabled by either passingprojection: globeto the map constructor or by callingmap.setProjection('globe'). All layers are supported by globe except for Custom Layers and Sky.Extend atmospheric
fogwith three new style specification properties:high-color,space-colorandstar-intensityto allow the design of atmosphere around the globe and night skies.Add a new line layer paint property in the style specification:
line-trim-offsetthat can be used to create a custom fade out with improved update performance overline-gradient.
Features
Add
globeprojection. This new projection displays the map as a 3d globe and can be enabled by either passingprojection: globeto the map constructor or by callingmap.setProjection('globe'). All layers are supported by globe except for Custom Layers and Sky.Extend atmospheric
fogwith three new style specification properties:high-color,space-colorandstar-intensityto allow the design of atmosphere around the globe and night skies.Add a new line layer paint property in the style specification:
line-trim-offsetthat can be used to create a custom fade out with improved update performance overline-gradient.Add an option for providing a geolocation adapter to
GeolocateControl. (#10400) (h/t behnammodi)Add
Map.Titleproperty to locale options to localise the maparia-label. (#11549) (h/t andrewharvey)Allow duplicated coordinates in tile request URLs. (#11441) (h/t ozero)
Bug fixes
Fix an issue which causes line layers to occasionally flicker.
Fix markers in fog sometimes becoming more visible when behind terrain.
Fix an issue where setting terrain exageration to 0 could prevent the zoom to be resolved.
Copy stylesheet to allow toggling different styles using setStyle without overwriting some of the properties.
2.8.2
22 Apr 2022Fix an issue where the special bundle for CSP-restricted environments was not compatible with further minification in some bundling setups.
2.8.1
13 Apr 2022Fix the special bundle for CSP-restricted environments that broke in the 2.8.0 release.
2.8.0
7 Apr 2022Improve memory usage by freeing memory more eagerly after loading tiles.
Improve memory usage by reducing repeated line labels on overscaled tiles.
Improve performance when placing many symbols on terrain.
Performance improvements
Improve memory usage by freeing memory more eagerly after loading tiles.
Improve memory usage by reducing repeated line labels on overscaled tiles.
Improve performance when placing many symbols on terrain.
Bug fixes
Fix
map.fitBounds(),map.fitScreenCoordinates(), andmap.cameraForBounds()incorrectly matching bounds with non-zero bearing. (#11568) (h/t TannerPerrien)Improve control button appearance by applying
border-radiusmore consistently. (#11423) (h/t nagix)Fix
ScaleControldisplaying incorrect units with some projections.Fix performance regression when animating image sources.
Fix
MapDataEvent.isSourceLoaded()to check if specific source has loaded.Fix map not wrapping after moving the map with no inertia.
Fix popup not removing event listeners when
closeOnClick:true.Fix camera occasionally intersecting terrain when DEM data loads while zooming. (#11461, #11578)
Increase clarity of line layers with the terrain on high DPI devices.
Fix canvas size if more than one parent container has a transform CSS property.
Fix error on calling
map.removeImage()on animated image.Fix occasional issue with
fill-extrusionlayers not rendering on tile borders when used with terrain.
Workflow
Upgrade Flow from
v0.108.0tov0.142.0and enable type-first mode, greatly improving performance of type-checking.
2.7.1
18 Mar 2022Work around a Safari rendering bug by disabling WebGL context antialiasing for Safari 15.4 and 15.5
Fix disabling cooperative gesture handling when map is fullscreen in Safari
2.7.0
31 Jan 2022Enable preloading tiles for camera animation.
Improve quality of transparent line layers by removing overlapping geometry artifacts. (#11082). Note: removing that feature can be done by using the line color alpha channel, e.g.
line-color: "rgba(r, g, b, 0.5)"instead ofline-opacity.Add perspective correction for non-rectangular image, canvas and video sources.
Features ✨ and improvements
Enable preloading tiles for camera animation.
Improve quality of transparent line layers by removing overlapping geometry artifacts. (#11082). Note: removing that feature can be done by using the line color alpha channel, e.g.
line-color: "rgba(r, g, b, 0.5)"instead ofline-opacity.Add perspective correction for non-rectangular image, canvas and video sources.
Improve performance of default markers.
Add marker methods
setSnapToPixelandgetSnapToPixelto indicate rounding a marker to pixel. (#11167) (h/t malekeym)Add a default
aria-labelfor interactive markers for improved user accessibility.Add support for sparse tile sets to DEM data sources, when served tiles don't go up to the full
maxzoom.Allow users to set order of custom attribution.
Add function call chaining to function
map.setProjection(#11279) (h/t lpizzinidev)
Bug fixes
Fix canvas size to evaluate to expected value when applying the CSS transform property.
Fix
getBoundssometimes returning invalidLngLatwhen zooming on a map with terrain. (#11339) (h/t @ted-piotrowski)Fix rendering of denormalized strings with diacritics.
Remove redundant title attribute from
Improve this Mapattribution element.Fix a rare terrain flickering issue when using terrain with multiple vector data sources.
2.6.1
19 Nov 2021Remove Object spread syntax to ensure older build systems continue to work as expected.
2.6.0
8 Nov 2021Add support for a variety of new map projections beyond the standard Web Mercator. Alternate projections can be used together with all existing styles and sources. The projections eliminate distortion as you zoom to make them useful at every scale. Supported projections include
albers,equalEarth,equirectangular,lambertConformalConic,naturalEarthandwinkelTripel. Change the projection by setting it in the map constructor:new Map({ projection: 'winkelTripel', ... }).Add support for dynamic filtering of symbols based on pitch and distance to map center.
["pitch"]and["distance-from-camera"]expressions can now be used within thefilterof a symbol layer.
Features and improvements
Add support for a variety of new map projections beyond the standard Web Mercator. Alternate projections can be used together with all existing styles and sources. The projections eliminate distortion as you zoom to make them useful at every scale. Supported projections include
albers,equalEarth,equirectangular,lambertConformalConic,naturalEarthandwinkelTripel. Change the projection by setting it in the map constructor:new Map({ projection: 'winkelTripel', ... }).Limitations: Non-mercator projections do not yet support terrain, fog, free camera or CustomLayerInterface.
Add a new
"cooperativeGestures": truemap option that prevents the map from capturing page scrolling and panning. When enabled, scroll zooming requiresctrlor⌘to be pressed and touch panning requires two fingers (#11029, #11116)Add support for dynamic filtering of symbols based on pitch and distance to map center.
["pitch"]and["distance-from-camera"]expressions can now be used within thefilterof a symbol layer.Improve user accessibility: conveying only
aria-labelin controls, replacearia-pressedwitharia-expandedin the attribution control, interactive markers with popups express anaria-expandedstate, and interactive markers have the role "button".Add support for conditionally styling most paint properties according to the presence or absence of specific images.
Add support for attaching events to multiple layers with
map.on(), allowing users to get retrieve features under the mouse or touch event based on the order in which they are rendered. (#11114)(h/t @omerbn)
Bug fixes
Fix
map.setFeatureState(...)not updating rendering when terrain is enabled.Fix marker positioning before initial map load
Fix slow tile loading performance on maps with CJK glyphs on certain Chrome/GPU combinations.
Update NavigationControl when
minandmaxzoom are changedPrevent video sources from entering fullscreen on iOS Safari
Fix a rare triangulation issue that could cause an infinite loop
Fix
nullfeature values returned as"null"byqueryRenderedFeatures(...)Fix rendering issue with power of two square images and
'raster-resampling': 'nearest'
2.5.1
6 Oct 2021Fix an iOS 15 issue where the iOS Safari tab bar interrupts touch interactions.
2.5.0
29 Sep 2021Added
queryRenderedFeaturessupport to heatmap layers.Added support for using
line-gradientandline-dasharraypaint properties together on line layers.Added
preclickevent allowing popups to close and open in a new location on one click.
Features ✨ and improvements
Added
queryRenderedFeaturessupport to heatmap layers.Added support for using
line-gradientandline-dasharraypaint properties together on line layers.Added
preclickevent allowing popups to close and open in a new location on one click.Improved collision detection for labels along lines, slightly improving label density.
Improved Popup
addClassName,removeClassNameandtoggleClassNamemethods to work on popup instances that are not added to the map.⚠️ Note: Direct modifications to the popup container CSS class no longer persist. These methods should be used instead.
Bug fixes
Fixed
maxBoundsproperty not working across the 180th meridian.Fixed
map.getBounds()returning too-large bounds under some conditions.Fixed markers not updating position when toggling terrain.
Fixed gap on edge of map on retina displays.
Fixed SDF images rendering inside text.
Fixed an issue with slow tile loading performance on maps with CJK glyphs on certain Chrome/GPU combinations.
2.4.1
16 Aug 20212.4.0
30 Jul 2021Add support for
text-writing-modeproperty when usingsymbol-placement: linetext labels.Improve character alignment in labels with mixed CJK and Latin characters by adding support for
descenderandascenderfont metrics.
Features and improvements
Add
showUserHeadingoption toGeolocateControlthat draws a triangle in front of the dot to denote both the user's location, and the direction they're facing.(#10817) (h/t to @tsuz)Add support for
text-writing-modeproperty when usingsymbol-placement: linetext labels.Note: This change will bring the following changes for CJK text blocks:
For vertical CJK text, all the characters including Latin and Numbers will be vertically placed now. Previously, Latin and Numbers were horizontally placed.
For horizontal CJK text, there may be a slight horizontal shift due to the anchor shift.
Improve character alignment in labels with mixed CJK and Latin characters by adding support for
descenderandascenderfont metrics.Improve terrain performance by reducing number of framebuffer switches during draping.
Improve terrain performance by prioritizing allocation of large render cache batches.
Improve behavior of vertically aligned line labels with horizontal text by adding stickiness to their flip state, preventing them from flickering.
Bug fixes
Fix a potential rendering artifact when using custom
fill-extrusiondataset with terrain.Fix anchor calculation for
line-centerline labels when the anchor is very near to line segment endpoints.Fix
ImageSourcebreaking in Firefox/Safari if it's not immediately visible.Fix gradient skybox rendering issue on some ARM Mali GPU's.
2.3.1
21 Jun 2021Fix fog flickering when the map option
optimizeForTerrainis set to falseFix collision boxes which were not correctly updated for symbols with
text-variable-anchor
2.3.0
27 May 2021Add configurable fog as a root style specification
Add support for data-driven expressions in
line-dasharrayandline-capproperties.Add support for data-driven
text-line-height
Features and improvements
Add configurable fog as a root style specification
Add support for data-driven expressions in
line-dasharrayandline-capproperties.Add support for data-driven
text-line-heightAdd client-side elevation querying with
map.queryTerrainElevation(lngLat)when terrain is activeReduce GPU memory footprint when terrain is active by sharing a single depth stencil renderbuffer for all draping
Optimize tile cover by preventing unnecessary tile loads when terrain is active
Batch render DOM elements to avoid reflow (#10530, #10567) (h/t zarov)
Bug fixes
Fix style property transitions not invalidating the terrain render cache
Fix raster tile expiry data not being retained. (#10494) (h/t andycalder)
Fix undefined type error when removing
line-gradientpaint propertyFix unclustered points in a clustered GeoJSON source incorrectly snapping to a grid at high zoom levels.
Fix
map.loadImagefollowed with a delay bymap.addImagefailing in Safari and Firefox.Allow conditional display of formatted images in text
Fix fill-extrusion elevation underflow below sea level
Fix dashed lines with square line caps.
Fix markers sometimes throwing an error after being removed from a 3D map. (#10478) (h/t andycalder)
Set
type=buttonon attribution button to prevent accidental form submit when map is nested in<form>
2.2.0
25 Mar 2021Improve
geojsonSource.setData(...)performance in SafariAdd
map.getTerrain()methodAdd
showTerrainWireframemap debug option for displaying terrain wireframe
Features and improvements
Improve
geojsonSource.setData(...)performance in SafariAdd
map.getTerrain()methodAdd
showTerrainWireframemap debug option for displaying terrain wireframeDocument the default limit and offset of
geojsonSource.getClusterLeaves(...)(#10403) (h/t henk23)(Development) Update dev environment to native ES modules to support Node 14+
Bug fixes
Fix
map.getBounds()to return the inset bounds when map padding is setSupport flat roofs for fill-extrusions when using custom data sources with terrain
Fix flickering accuracy circle in
GeolocateControl. (#10334) (h/t anderswi)Show Mapbox logo if no style is provided for the map
Switch to using alphabetic baseline for locally-rendered glyphs to avoid misalignment on fonts with large ascenders/descenders.
Fix incorrect diffing of styles when using raster DEM tile sources
Fix
queryRenderedFeatures(...)for fill-extrusions partly behind the cameraFix artifacts caused by negative terrain elevation
Reset WebGL culling state before drawing custom layers
Fix DOM event coordinates for scaled containers (#10096) (h/t kawsndriy)
Fix
collectResourceTimingerrors
2.1.0
4 Feb 2021Added
localFontFamilymap option that enables local generation of all font glyphs.Introduced high resolution local glyph generation for improved rendering quality of glyphs generated using
localIdeographFontFamilyorlocalFontFamilyoptions.Added
optimizeForTerrainmap option allowing to use terrain in layer draw-order or performance priority mode. This fixes terrain not always preserving layer draw-order during animations by making the behavior explicit.
Features and improvements
Added
localFontFamilymap option that enables local generation of all font glyphs.Introduced high resolution local glyph generation for improved rendering quality of glyphs generated using
localIdeographFontFamilyorlocalFontFamilyoptions.Added
optimizeForTerrainmap option allowing to use terrain in layer draw-order or performance priority mode. This fixes terrain not always preserving layer draw-order during animations by making the behavior explicit.Improved performance by slightly shifting the horizon down, reducing the number of tiles loaded for highly-pitched maps.
Improved
evented.once(eventName)to return a promise if no listener function is provided, which allows usingasync/awaitwith map events for a simpler and more readable code.
Bug fixes
Fixed querying of
fill-extrusions when terrain is enabled.Fixed a bug where close points were sometimes not clustered on higher zoom levels given a small clustering radius. Fixed
clusterMaxZoomso that it is not capped by the sourcemaxzoom.Fixed blurry map-aligned labels on highly pitched maps with terrain.
Fixed a race condition when evaluating image expressions by ensuring sprite has loaded before parsing tiles.
Fixed a bug with fullscreen
fill-extrusionquerying at low pitch.Fixed a regression with the usage of patterns with data-driven styling.
Ensure
evented.listensreturnsfalsewhen no listener is available.
2.0.1
23 Dec 2020Added support for using third-party worker-loader plugins in build systems such as Webpack and Rollup (
mapboxgl.workerClass). #10219Added
mapboxgl.setNowandmapboxgl.restoreNowmethods which allow setting custom animation timing for 60 fps, jank-free video recording. #10172Removed outdated CSS hacks that no longer apply. #10202
Features and improvements
Added support for using third-party worker-loader plugins in build systems such as Webpack and Rollup (
mapboxgl.workerClass). #10219Added
mapboxgl.setNowandmapboxgl.restoreNowmethods which allow setting custom animation timing for 60 fps, jank-free video recording. #10172Removed outdated CSS hacks that no longer apply. #10202
Bug fixes
Fixed a bug where
ImageSourceand dynamically loaded icons didn't work in some cases in Firefox and Safari. #10230Fixed a bug where
map.unprojectandmap.panByacted unpredictably in certain cases. #10224Fixed a bug where the sky layer didn't take map padding into account. #10201
Fixed a bug where
map.setStylecouldn't be used to enable terrain. #10177Fixed a bug where mouse events didn't properly fire during zoom scrolling. #10171
2.0.0
8 Dec 2020- breaking
mapbox-gl-js is no longer under the 3-Clause BSD license. By upgrading to this release, you are agreeing to Mapbox terms of service. Refer to LICENSE.txt for the new licensing terms and details. For questions, contact our team at support.mapbox.com.
- breaking
Beginning with v2.0.0, a billable map load occurs whenever a Map object is initialized. Before updating an existing implementation from v1.x.x to v2.x.x, please review the pricing documentation to estimate expected costs.
Breaking changes
- breaking
mapbox-gl-js is no longer under the 3-Clause BSD license. By upgrading to this release, you are agreeing to Mapbox terms of service. Refer to LICENSE.txt for the new licensing terms and details. For questions, contact our team at support.mapbox.com.
- breaking
Beginning with v2.0.0, a billable map load occurs whenever a Map object is initialized. Before updating an existing implementation from v1.x.x to v2.x.x, please review the pricing documentation to estimate expected costs.
- deprecated
Deprecate Internet Explorer 11, no longer supported from this release. (#8283, #6391)
- breaking
Support for unlocked pitch up to 85°. The default
maxPitchis increased from 60° to 85° which can result in viewing above the horizon line. By default, this area will be drawn transparent but a new sky layer can be added to the map in order to fill this space. The legacy behavior can be achieved by simply addingmaxPitch: 60to the map options when instantiating your map.
Features and improvements
Add 3D terrain feature. All layer types and markers can now be extruded using the new
terrainroot level style-spec property or with the functionmap.setTerrain().Add support for unlocked pitch up to 85° (previously 60°).
Add a new sky layer acting as an infinite background above the horizon line. This layer can be used from the style-spec and has two types:
atmosphericandgradient.Add a free form camera API, allowing for more complex camera manipulation in 3D, accessible using
map.getFreeCameraOptions()andmap.setFreeCameraOptions().Improve performance by adopting a two-phase tile loading strategy, prioritizing rendering of non-symbol layers first.
Improve performance by avoiding parsing vector tiles that were already aborted.
Improve performance by adopting a preemptive shader compilation strategy.
Improve performance by disabling fade-in animation for symbols and raster tiles on initial map load.
Improve performance by defaulting to 2 workers on all platforms.
Improve performance by loading tiles on the main thread at initial map load.
Improve performance by using better worker task scheduling.
Bug fixes
Avoid reloading
rasterandraster-demtiles when the RTLTextPlugin loads.Add runtime evaluation of label collision boxes for more accurate symbol placement at fractional zoom levels and tilted views.
Fix tile cache size for terrain DEM sources.
Prevent holding on to DEM memory on the worker.
Reduce memory used by
fill-extrusions.
Workflow
Run render tests in browser.
- 1.x
1.13.3
19 Jan 2023- security
Upgrade minimist to ^1.2.7 to avoid CVE-2021-44906 (#12442) (h/t @Spasfonx)
Fix incorrect billing when
customAccessTokenis provided along with non-Mapbox tilesPrevent video sources from entering fullscreen on iOS Safari
1.13.2
8 Oct 2021Backport a fix for an iOS 15 issue where the iOS Safari tab bar interrupts touch interactions.
1.13.0
19 Nov 2020Improve accessibility by fixing issues reported by WCAG 2.1. #9991
Improve accessibility when opening a popup by immediately focusing on the content. #9774 (h/t @watofundefined)
Features and improvements
Improve accessibility by fixing issues reported by WCAG 2.1. #9991
Improve accessibility when opening a popup by immediately focusing on the content. #9774 (h/t @watofundefined)
Improve rendering performance of symbols with
symbol-sort-key. #9751 (h/t @osvodef)Add
MarkerclickToleranceoption. #9640 (h/t @ChristopherChudzicki)Add
MaphasControlmethod. #10035Add
KeyboardHandlerdisableRotationandenableRotationmethods. #10072 (h/t @jmbott)
Bug fixes
Fix a bug where
queryRenderedFeaturesdidn't properly expose the paint values if they were data-driven. #10074 (h/t @osvodef)Fix a bug where attribution didn't update when layer visibility changed during zooming. #9943
Fix a bug where hash control conflicted with external history manipulation (e.g. in single-page apps). #9960 (h/t @raegen)
Fix a bug where
fitBoundshad an unexpected result with non-zero bearing and uneven padding. #9821 (h/t @allison-strandberg)Fix HTTP support when running GL JS against Mapbox Atlas. #10090
Fix a bug where the
withinexpression didn't work inquerySourceFeatures. #9933Fix a bug where
Popupcontent HTML element was removed onsetDOMContent. #10036Fix a compatibility bug when
icon-imageis used as a legacy categorical function. #10060Reduce rapid memory growth in Safari by ensuring
ImagedataURI's are released. #10118
Note on IE11
We intend to remove support for Internet Explorer 11 in a future release of GL JS later this year.
1.12.0
12 Aug 2020Add methods for changing a vector tile source dynamically (e.g.
setTiles,setUrl). #8048 (h/t @stepankuzmin)Add a
filteroption for GeoJSON sources to filter out features prior to processing (e.g. before clustering). #9864Vastly increase precision of
line-gradientfor long lines. #9694
Features and improvements
Add methods for changing a vector tile source dynamically (e.g.
setTiles,setUrl). #8048 (h/t @stepankuzmin)Add a
filteroption for GeoJSON sources to filter out features prior to processing (e.g. before clustering). #9864Vastly increase precision of
line-gradientfor long lines. #9694Improve
raster-demsources to properly support themaxzoomoption and overzooming. #9789 (h/t @brendan-ward)
Bug fixes
Fix a bug where bearing snap interfered with
easeToandflyToanimations, freezing the map. #9884 (h/t @andycalder)Fix a bug where a fallback image was not used if it was added via
addImage. #9911 (h/t @francois2metz)Fix a bug where
promoteIdoption failed for fill extrusions with defined feature ids. #9863
Workflow
Renamed the default development branch from
mastertomain.
Note on IE11
We intend to remove support for Internet Explorer 11 in a future release of GL JS later this year. Watch this repository for more information on how to prepare your codebase for this change.
1.11.1
7 Jul 2020Fix a bug that caused
map.loaded()to incorrectly returnfalseafter a click event.
1.11.0
10 Jun 2020Add an option to scale the default
Markericon.(#9414) (h/t adrianababakanian)Improving the shader compilation speed by manually getting the run-time attributes and uniforms.
Added
clusterMinPointsoption for clustered GeoJSON sources that defines the minimum number of points to form a cluster.
Features and improvements
Add an option to scale the default
Markericon.(#9414) (h/t adrianababakanian)Improving the shader compilation speed by manually getting the run-time attributes and uniforms.
Added
clusterMinPointsoption for clustered GeoJSON sources that defines the minimum number of points to form a cluster.
Bug fixes
Fix a bug where map got stuck in a DragRotate interaction if it's mouseup occurred outside of the browser window or iframe.
Fix potential visual regression for
*-patternproperties on AMD graphics card vendor.Fix zooming with a double tap on iOS Safari 13.
Removed a misleading
geometry exceeds allowed extentwarning when using Mapbox Streets vector tiles.Fix reference error when requiring the browser bundle in Node.
1.10.2
10 Jun 2020Fix zooming with a double tap in iOS Safari 13
1.10.1
15 May 2020Bug fixes
Fix markers interrupting touch gestures (#9675, fixed by #9683)
Fix bug where
map.isMoving()returned true while map was not moving (#9647, fixed by #9679)Fix regression that prevented
touchmoveevents from firing during gestures (#9676, fixed by #9685)Fix
imageexpression evaluation which was broken under certain conditions (#9630, fixed by #9685)Fix nested
withinexpressions in filters not evaluating correctly (#9605, fixed by #9611)Fix potential
undefinedpaint variable inStyleLayer(#9688) (h/t mannnick24)
1.10.0
27 Apr 2020- security
Upgrade minimist to ^1.2.5 to get fix for security issue CVE-2020-7598 upstream (#9425, fixed by #9425) (h/t watson)
Add
mapboxgl.prewarm()andmapboxgl.clearPrewarmedResources()methods to allow developers to optimize load times for their maps
Features
Add
mapboxgl.prewarm()andmapboxgl.clearPrewarmedResources()methods to allow developers to optimize load times for their mapsAdd
index-ofandsliceexpressions to search arrays and strings for the first occurrence of a specified value and return a section of the original array or string (#9450) (h/t lbutler)Correctly set RTL text plugin status if the plugin URL could not be loaded. This allows developers to add retry logic on network errors when loading the plugin
Gestures
This release significantly refactors and improves gesture handling on desktop and mobile. Three new touch gestures have been added:
two-finger swipeto adjust pitch,two-finger double-tapto zoom out, andtap then dragto adjust zoom with one finger (#9365). In addition, this release brings the following changes and bug fixes:It's now possible to interact with multiple maps on the same page at the same time
Fix map jump when releasing one finger after pinch zoom
Stop
mousedownandtouchstartfrom interruptingeaseToanimations when interaction handlers are disabledStop mouse wheel from interrupting animations when
map.scrollZoomis disabledA camera change can no longer be prevented by disabling the interaction handler within the camera change event. Selectively prevent camera changes by listening to the
mousedownortouchstartmap event and calling .preventDefault()Undocumented properties on the camera change events fired by the
doubleClickZoomhandler have been removed
Improvements and bug fixes
Line labels now have improved collision detection, with greater precision in placement, reduced memory footprint, better placement under pitched camera orientations
Fix
GlyphManagercontinually re-requesting missing glyph ranges (#8027, fixed by #9375) (h/t oterral)Avoid throwing errors when calling certain popup methods before the popup element is created
Fix a bug where fill-extrusion features with colinear points were not returned by
map.queryRenderedFeatures(...)Fix a bug where using feature state on a large input could cause a stack overflow error
Fix exception when using
background-patternwith data driven expressions (#9518, fixed by #9520)Fix a bug where UI popups were potentially leaking event listeners (#9498) (h/t mbell697)
Fix a bug where the
withinexpression would return inconsistent values for points on tile boundaries (#9411, #9428)Fix a bug where the
withinexpression would incorrectly evaluate geometries that cross the antimeridianFix possible undefined exception on paint variable of style layer (#9437) (h/t mannnick24)
- security
Upgrade minimist to ^1.2.5 to get fix for security issue CVE-2020-7598 upstream (#9425, fixed by #9425) (h/t watson)
1.9.1
3 Apr 2020Fix a bug #9477 in
Map#fitBounds(..)wherein thepaddingpassed to options would get applied twice.Fix rendering bug #9479 caused when data-driven
*-patternproperties reference images added withMap#addImage(..).Fix a bug #9468 in which an exception would get thrown when updating symbol layer paint property using
setPaintProperty.
1.9.0
23 Mar 2020Add
withinexpression for testing whether an evaluated feature lies within a given GeoJSON object (#9352).Map API functions such as
easeToandflyTonow supportpadding: PaddingOptionswhich lets developers shift a map's center of perspective when building floating sidebarsResults from
queryRenderedFeaturesnow have evaluated property values rather than raw expressions
With this release, we're adding a new changelog policy to our contribution guidelines.
This release also fixes several long-standing bugs and unintentional rendering behavior with
line-pattern. The fixes come with a visual change to how patterns added withline-patternscale. Previously, patterns that became larger than the line would be clipped, sometimes distorting the pattern, particularly on mobile and retina devices. Now the pattern will be scaled to fit under all circumstances. #9266 showcases examples of the visual differences. For more information and to provide feedback on this change, see #9394.Features
Add
withinexpression for testing whether an evaluated feature lies within a given GeoJSON object (#9352).We are aware of an edge case in which points with wrapped coordinates (e.g. longitude -185) are not evaluated properly. See (#9442) for more information.
An example of the
withinexpression:"icon-opacity": ["case", ["==", ["within", "some-polygon"], true], 1, ["==", ["within", "some-polygon"], false], 0]
Map API functions such as
easeToandflyTonow supportpadding: PaddingOptionswhich lets developers shift a map's center of perspective when building floating sidebars
Improvements
Results from
queryRenderedFeaturesnow have evaluated property values rather than raw expressionsImprove scaling of patterns used in
line-patternon all device resolutions and pixel ratiosSlightly improve GPU memory footprint
LngLatBounds.extendis more flexible because it now accepts objects withlatandlonproperties as well as arrays of coordinatesReduce bundle size and improve visual quality of
showTileBoundariesdebug text
Bug fixes
Correctly adjust patterns added with
addImage(id, image, pixelRatio)by the asset pixel ratio, not the device pixel ratioAllow needle argument to
inexpression to be falseFix exception thrown when trying to set
feature-statefor a layer that has been removed, fixes #8634Fix a bug where maps were not displaying inside elements with
dir=rtlFix a rendering error for very old versions of Chrome (ca. 2016) where text would appear much bigger than intended
Prevent exception resulting from
line-dash-arrayof empty lengthFix a bug where
icon-imageexpression that evaluates to an empty string ('') produced a warningFix a bug where certain
popupmethods threw errors when accessing the container element before it was created, fixes #9429
1.8.0
20 Feb 2020Reduce size of line atlas by removing unused channels
Prevent empty buffers from being created for debug data when unused
Features and improvements
Reduce size of line atlas by removing unused channels
Prevent empty buffers from being created for debug data when unused
Add space between distance and unit in scale control (#9276) (h/t gely) and (#9284) (h/t pakastin)
Add a
showAccuracyCircleoption to GeolocateControl that shows the accuracy of the user's location as a transparent circle. Mapbox GL JS will show this circle by default. (#9253) (h/t Meekohi)Implemented a new tile coverage algorithm to enable level-of-detail support in a future release
Bug fixes
line-dasharrayis now ignored correctly whenline-patternis setFix line distances breaking gradient across tile boundaries
Fix a bug where lines with duplicate endpoints could disappear at zoom 18+
Fix a bug where Ctrl-click to drag rotate the map was disabled if the Alt, Cmd or Windows key is also pressed
Pass errors to
getClusterExpansionZoom,getClusterChildren, andgetClusterLeavescallbacksFix a rendering performance regression
Fix visual artifact for
line-dasharrayFixed a bug in the GeolocateControl which resulted in an error when
trackUserLocationwasfalseand the control was removed before the Geolocation API had returned a locationFix
promoteIdfor line layersImprove accuracy of distance calculations (#9202) (h/t Meekohi)
1.7.0
27 Jan 2020Add
promoteIdoption to use a feature property as ID for feature stateAdd a new constructor option to
mapboxgl.Popup,closeOnMove, that closes the popup when the map's position changesAllow creating a map without a style (an empty one will be created automatically) ( h/t @stepankuzmin )
Features
Add
promoteIdoption to use a feature property as ID for feature stateAdd a new constructor option to
mapboxgl.Popup,closeOnMove, that closes the popup when the map's position changesAllow creating a map without a style (an empty one will be created automatically) ( h/t @stepankuzmin )
map.once()now allows specifying a layer id as a third parameter making it consistent withmap.on()
Improvements
Improve performance of raster layers on large screens
Improve performance for hillshade and raster layers by implementing a progressive enhancement that utilizes
ImageBitmapandOffscreenCanvasImprove performance for raster tile rendering by using the stencil buffer
Update
symbol-avoid-edgesdocumentation to acknowledge the existence of global collision detectionRemove reference to
infunction which has been replaced by theinexpression
Bug Fixes
Change the type of tile id key to string to prevent hash collisions
Prevent changing bearing via URL hash when rotation is disabled
Fix URL hash with no bearing causing map to fail to load
Fix bug in
GeolocateControlwhere multiple instances of the control on one page may result in the user location not being updatedFix query
fill-extrusionsmade from polygons with coincident points and polygons with less than four pointsFix bug where
symbol-sort-keywas not used for collisions that crossed tile boundariesFix bug in
DragRotateHandler._onMouseUpgetting stuck in drag/rotateFix "Click on Compass" on some mobile devices (add
clickTolerancetoDragRotateHandler) (#9015) (h/t Yanonix)
1.6.1
19 Dec 2019Fix style validation error messages not being displayed
Fix deferred loading of rtl-text-plugin not working for labels created from GeoJSON sources
Fix RTL text not being rendered with the rtl-text-plugin on pages that don't allow
script-src: blob:in their CSP.
1.6.0
4 Dec 2019Add ability to insert images into text labels using an
imageexpression within aformatexpression:"text-field": ["format", "Some text", ["image", "my-image"], "some more text"]Add support for stretchable images (aka nine-part or nine-patch images). Stretchable images can be used with
icon-text-fitto draw resized images with unstretched corners and borders.Add
inexpression. It can check if a value is in an array (["in", value, array]) or a substring is in a string (["in", substring, string])
Features
Add ability to insert images into text labels using an
imageexpression within aformatexpression:"text-field": ["format", "Some text", ["image", "my-image"], "some more text"]Add support for stretchable images (aka nine-part or nine-patch images). Stretchable images can be used with
icon-text-fitto draw resized images with unstretched corners and borders.Add
inexpression. It can check if a value is in an array (["in", value, array]) or a substring is in a string (["in", substring, string])Add
minPitchandmaxPitchmap optionsAdd
rotation,rotationAlignmentandpitchAlignmentoptions to markers (#8836) (h/t dburnsii)Add methods to Popup to manipulate container class names (#8759) (h/t Ashot-KR)
Add configurable inertia settings for panning (h/t @aMoniker)
Add ability to localize mapbox UI controls (#8095) (h/t dmytro-gokun)
Add option to load rtl-text-plugin lazily
Add
essentialparameter to AnimationOptions that can overrideprefers-reduced-motion: reduce(#8743, fixed by #8883)
Improvements
Allow rendering full world smaller than 512px. To restore the previous limit call
map.setMinZoom(0)Add an es modules build of for mapbox-gl-style-spec in dist/ (#8247) (h/t ahocevar)
Add 'image/webp,/' accept header to fetch/ajax image requests when webp supported
Improve documentation for setStyle, getStyle, and isStyleLoaded
Bug Fixes
Fix map rendering after addImage and removeImage are used to change a used image
Fix visibility of controls in High Contrast mode in IE
Fix customizable url hash string in IE 11 (#8990) (h/t pakastin)
Allow expression stops up to zoom 24 instead of 22 (#8908) (h/t nicholas-l)
Fix alignment of lines in really overscaled tiles
Fix
Failed to execute 'shaderSource' on 'WebGLRenderingContext'errorsMake expression validation fail on NaN
Fix setLayerZoomRange bug that caused tiles to be re-requested (#7865, fixed by #8854)
Fix
map.showTileBoundariesrenderingFix using
generateIdin conjunction withclusterin a GeoJSONSource (#8223, fixed by #8945)Fix opening popup on a marker from keyboard
Fix error thrown when request aborted (#7614, fixed by #9021)
Fix attribution control when repeatedly removing and adding it
1.5.1
27 Nov 2019Implement workaround for memory leak in Safari when using the
CacheStorageAPI.Implement workaround for memory leak in Safari when using
Transferableobjects to transferArrayBuffersto WebWorkers. If GL-JS detetcts that it is running in Safari, the use ofTransferablesto transfer data to WebWorkers is disabled.
This patch introduces two workarounds that address longstanding issues related to unbounded memory growth in Safari, including #8771 and #4695. We’ve identified two memory leaks in Safari: one in the CacheStorage API, addressed by #8956, and one in transferring data between web workers through Transferables, addressed by #9003.
Improvements
Implement workaround for memory leak in Safari when using the
CacheStorageAPI.Implement workaround for memory leak in Safari when using
Transferableobjects to transferArrayBuffersto WebWorkers. If GL-JS detetcts that it is running in Safari, the use ofTransferablesto transfer data to WebWorkers is disabled.Improve animation performance when using
map.setData. (#8913) (h/t msbarry)
1.5.0
25 Oct 2019Add disabled icon to GeolocateControl if user denies geolocation permission. #8871)
Add
outofmaxboundsevent to GeolocateControl, which is emitted when the user is outside ofmap.maxBounds(#8756) (h/t MoradiDavijani)Add
mapboxgl.getRTLTextPluginStatus()to query the current status of thertl-text-pluginto make it easier to allow clearing the plugin when necessary. (ref. #7869)
Features
Add disabled icon to GeolocateControl if user denies geolocation permission. #8871)
Add
outofmaxboundsevent to GeolocateControl, which is emitted when the user is outside ofmap.maxBounds(#8756) (h/t MoradiDavijani)Add
mapboxgl.getRTLTextPluginStatus()to query the current status of thertl-text-pluginto make it easier to allow clearing the plugin when necessary. (ref. #7869)Allow
hashMap option to be set as a string, which sets the map hash in the url to a custom query parameter. (#8603) (h/t SebCorbin)
Improvements
Fade symbols faster when zooming out quickly, reducing overlap.
Reduce memory usage for vector tiles that contain long strings in feature properties.
Bug Fixes
Fix
text-variable-anchornot trying multiple placements during collision with icons whenicon-text-fitis enabled.Fix
icon-text-fitnot properly respecting vertical labels.Fix opacity interpolation for composition expressions.
Fix rotate and pitch events being fired at the same time.
Fix memory leaks that occured during tile loading and map removal.(#8813 and #8850)
Fix web-worker transfer of
ArrayBuffersin environments whereinstanceof ArrayBufferfails.(e.gcypress)