fill-extrusion
querying with ray picking (#7499)clusterProperties
option for aggregated cluster properties (#2412, fixed by #7584)fitBounds
options. (#7681) (h/t elyobo)Map#remove
(#7749) (h/t andycalder)Map#removeFeatureState
(#7761)number-format
expression (#7626)symbol-sort-key
style property (#7678)file://
protocol in XHR requests for Cordova/Ionic/etc (#7818)LngLat.toBounds()
default radius to 0 (#7722, fixed by #7723) (h/t cherniavskii)feature-state
dependent layers (#7523, fixed by #7790)map.repaint
from mistakenly enabling continuous repaints (#7667)mapbox://
urls so they can be transformed with config.API_URL
(#7594)config.API_URL
(#7594)November 7, 2018
MercatorCoordinate
type (#7488)contextmenu
to be enabled (#2301, fixed by #7369)LngLat
conversion from {lat, lon}
(#7507) (h/t bfrengley)hash
within iframes in IE11 (#7411)October 10, 2018
concat
expression and text-field
property (#6190, fixed by #7280)fill-extrusion-vertical-gradient
property for controlling shading of fill extrusions (#5768, fixed by #6841)ImageSource
(#4050, fixed by #7342) (h/t dcervelli)log2
and log10
in IE11 (#7318, fixed by #7320)let
expression stripping expected type during parsing (#7300, fixed by #7301)literal
expression (#7336, fixed by #7337)to-color
on values that are already of type Color
(#7260)to-array
for empty arrays ((#7261))text-field
when using formatted text (#7351)null
to 0
in to-number
expression (#7083, fixed by #7274)loaded
after certain runtime styling changes when there were errored tiles in the viewport (#7355)*-allow-overlap: true
when panning into the viewport (#7172, fixed by#7244)mouseover
event (#7295, fixed by #7299)getImage
if an SVG is requested (#7312, fixed by #7313)September 6, 2018
client{Height/Width}
instead of offset{Height/Width}
for map canvas sizing (#6848, fixed by #7128)icon-allow-overlap: true, text-allow-overlap: true, text-optional: false
would show icons when they shouldn't (#7041)gl-style-migrate
script to include conversion of legacy functions and filters to their expression equivalents (#6927, fixed by #7095)icon-size
for small data-driven values (#7125)symbol-z-order
symbol layout property to style spec (#7219)*-pattern properties
(#6289)Map#fitScreenCoordinates
which fits viewport to two points, similar to Map#fitBounds
but uses screen coordinates and supports non-zero map bearings (#6894)Map#setFeatureState
and Map#getFeatureState
to accept numeric IDs (#7106) (h/t bfrengley)August 16, 2018
text-max-angle
property was being calculated incorrectly internally, causing potential rendering errors when "symbol-placement": line
feature.id
when using Map#setFeatureState
(#6974)GeolocateControl
when user location is being used (#6977) (h/t sergei-zelinsky)Map#querySourceFeatures
was returning bad results on zooms > maxZoom (#7061)queryPadding
for all layers in a source was set by the first layer, causing incorrect querying on other layers and, in some cases, incorrect firing of events associated with individual layers (#6909){Glyph/Image}Atlas
es (#7091)Map#setFeatureState
API (#7043)) (#7091)"format"
expression (#6994)raster-resampling
raster paint property (#6411) (h/t andrewharvey)symbol-placement: line-center
(#6821)match
expressions with with case/==
(#6684)Map#setFeatureState
and feature-state
expression to support interactive styling (#6263)Marker
with setDraggable
(#6687)Map#listImages
for listing all currently active sprites/images (#6381)text/icon-rotate
for symbols with symbol-placement: point
(#6075)collectResourceTiming: true
in web workers (#6721)collectResourceTiming: true
generates error on iOS9 Safari, IE 11 (#6690)lineMetrics=true
only rendered first line (#6649)a
element does not open the url when clicked (#6730)setRTLTextPlugin
fails with relative URLs (#6719)Evented#fire
and Evented#listens
are now marked as private. Though Evented
is still exported, and fire
and listens
are still functional, we encourage you to seek alternatives; a future version may remove their API accessibility or change its behavior. If you are writing a class that needs event emitting functionality, consider using EventEmitter
or similar libraries instead."to-string"
expression operator now converts null
to an empty string rather than to "null"
. #6534line-gradient
property #6303abs
, round
, floor
, and ceil
expression operators #6496collator
expression for controlling case and diacritic sensitivity in string comparisons #6270caseSensitive
and diacriticSensitive
expressions to case-sensitive
and diacritic-sensitive
for consistency #6598collator
expressions for evaluating as constant to account for potential environment-specific differences in expression evaluation #6596raster-dem
tilesets #6103Map#isZooming
and Map#isRotating
methods #6128, #6183raster-dem
sources #6110preventDefault
method on mousedown
, touchstart
, and dblclick
events #6218originalEvent
property on zoomend
and moveend
for user-initiated scroll events (h/t @stepankuzmin) #6175value
in "length"
expressions #6244MapWheelEvent
#6237ScaleControl
units (h/t @ryanhamley) #6138, #6274open
event for Popup
#6311"object"
type assertions are no longer required when using expressions #6235anchor
option to Marker
#6350HTMLElement
is now passed to Marker
as part of the options
object, but the old function signature is still supported for backwards compatibility #6356Marker
SVG element (h/t @andrewharvey) #6416CanvasSource
initialization from HTMLElement
#6424is-supported-script
expression 6260raster-dem
tiles to pixel grid to eliminate blurry rendering on some devices #6059Map#queryRenderedFeatures
bugs:{text, icon}-offset
when querying#6135circle
layer features with -pitch-scaling: 'viewport'
or -pitch-alignment: 'map'
#6036Map
hash #6140Map#addLayer
is invoked with an id
of a preexisting layer #6147icon-image
would not be rendered if text-field
is an empty string #6164rotatestart
and rotateend
events #6187DragHandler
bugs where a left-button mouse click would end a right-button drag rotate and a drag gesture would not end if the control key is down on mouseup
#6193{DragPanHandler, DragRotateHandler}#disable
while a gesture is in progress #6232GeolocateControl
user location dot sizing when Map
's <div>
inherits box-sizing: border-box;
(h/t @andrewharvey) #6227array
expression error messages (h/t @drewbo) #6269line-width
larger than the sprite height of the line-pattern
property would render other sprite images #6246DragPanHandler
on mobile using Edge (note that zoom/rotate/pitch handlers still do not support Edge touch events #1928) #6325VectorTileWorkerSource#reloadTile
causing a rendering timeout #6308gl.stencilFunc
calls due to incorrect state checking (h/t @yangdonglai) #6330mousedown
or touchstart
would cancel camera animations in non-interactive maps #6338text-translate
#6365to-rgba
expression causing division by zero 6388*-pattern
properties with non-integer zoom stops #6430Map#remove
on a map with constructor option hash: true
throws an error (h/t @allthesignals) #6490Map#moveLayer(layerId, beforeId)
to remove the layer when layerId === beforeId
#6542Map#querySourceFeatures
to throw an Uncaught TypeError
(https://github.com/mapbox/mapbox-gl-js/pull/6555)target
property for mouse{enter,over,leave,out}
events #6623map.queryRenderedFeatures()
#6074script-src 'unsafe-eval'
#559LngLatBounds#isEmpty()
method #5917collectResourceTiming
option to the enable collection of Resource Timing data for requests that are made from Web Workers. (#5948)==
and !=
expressions #5947renderWorldCopies
#5932Map#remove()
#5943, #5951GeoJSONSource#setData()
caused labels to fade out and back in (#6002)move
events to be fired out of sync with actual map movements (#6005)Map
did not fire mouseover
events (#6000] (h/t @jay-manday)before
parameter to moveLayer
does not exist #5679"colorSpace": "hcl"
now uses shortest-path interpolation for hue #5811raster-dem
source type and hillshade
layer type #5286Map#hasImage
#5775==
and !=
expressions #5840coalesce
expressions more useful #5755supported()
now returns false on old IE 11 versions that don't support Web Worker blob URLs #5801to-rgba
and rgba
expressions #5778, #5866*-pattern
and line-dasharray
#5791colorSpace
function property #5843map.showCollisionBoxes
is set to false
#5673heatmap-color
#5682history.replaceState
error #5613heatmap-color
use expressions instead of stop functions #5624{tokens}
in expressions for text-field
and icon-image
#5599curve
expression into step
and interpolate
expressions #5542line-dasharray
#5519sqrt
expression #5493fitBounds
when both zooming and padding change #4846queryRenderedFeatures
on a heatmap layer #5594queryRenderedSymbols
to return results from different sources #5554circle-stroke-width
in queryRenderedFeatures
#5514circle-stroke-opacity
of 0 #5496icon-text-fit
with a data-driven text-size
#5632position
field in GeoJSON #5608Map#setStyle
.canvas
source contextType
option added in 0.40.0 #5449Previously, data-driven and zoom-driven styling relied on stop functions: you specify a feature property and a set of input-output pairs that essentially define a “scale” for how the style should be calculated based on the feature property. For example, the following would set circle colors on a green-to-red scale based on the value of feature.properties.population
:
"circle-color": {
"property": "population",
"stops": [
[0, "green"],
[1000000, "red"]
]
}
This approach is powerful, but we’ve seen a number of use cases that stop functions don't satisfy. Expressions provide the flexibility to address use cases like these:
Multiple feature properties
Using more than one feature property to calculate a given style property. E.g., styling land polygon colors based on both feature.properties.land_use_category
and feature.properties.elevation
.
Arithmetic
For some use cases it’s necessary to do some arithmetic on the input data. One example is sizing circles to represent quantitative data. Since a circle’s visual size on the screen is really its area (and A=πr^2), the right way to scale circle-radius
is square_root(feature.properties.input_data_value)
. Another example is unit conversions: feature data may include properties that are in some particular unit. Displaying such data in units appropriate to, say, a user’s preference or location, requires being able to do simple arithmetic (multiplication, division) on whatever value is in the data.
Conditional logic This is a big one: basic if-then logic, for example to decide exactly what text to display for a label based on which properties are available in the feature or even the length of the name. A key example of this is properly supporting bilingual labels, where we have to decide whether to show local + English, local-only, or English-only, based on the data that’s available for each feature.
String manipulation More dynamic control over label text with things like uppercase/lowercase/title case transforms, localized number formatting, etc. Without this functionality, crafting and iterating on label content entails a large data-prep burden.
Filters Style layer filters had similar limitations. Moreover, they use a different syntax, even though their job is very similar to that of data-driven styling functions: filters say, “here’s how to look at a feature and decide whether to draw it,” and data-driven style functions say, “here’s how to look at a feature and decide how to size/color/place it.” Expressions provide a unified syntax for defining parts of a style that need to be calculated dynamically from feature data.
For information on the syntax and behavior of expressions, please see the documentation.
CanvasSource
coordinates were flipped and improve performance for non-animated CanvasSource
s #5303fill-extrusion-height
property #5320Map#addImage
now requires the image as an HTMLImageElement
, ImageData
, or object with width
, height
, and
data
properties with the same format as ImageData
. It no longer accepts a raw ArrayBufferView
in the second
argument and width
and height
options in the third argument.canvas
sources now require a contextType
option specifying the drawing context associated with the source canvas. #5155fill-extrusion
layers on the same map #5101icon-anchor
property to symbol layers #5183transformRequest
option, allowing users to provide a callback that transforms resource request URLs #5021text-max-width
#5067text-letter-spacing
#5071line-join
#5020Map#addImage()
#5181Marker#getElement()
method #5242layer.minzoom
#2929center
option #5042 (h/t @karthikb351)Map#addLayer()
with an inline source would mutate its input #4040NavigationControl
triggered mouse events unexpectedly #5148NavigationControl
compass caused an error in IE 11 #4784fast-stable-stringify
module #5152Marker#togglePopup()
failing to return the marker instance #5116GeolocateControl
breaking changes #4479watchPosition
has been replaced with trackUserLocation
jumpTo
(not animated) to fitBounds
(animated). An effect of this is the map pitch is no longer reset, although the bearing is still reset to 0.maxZoom
can be controlled via the new fitBoundsOptions
option (defaults to 15).Marker
s at their center by default #5019 @andrewharveysignificantRotateThreshold
for the TouchZoomRotateHandler
#4971, @dagjomarGeolocateControl
#4479, @andrewharveyshowUserLocation
to draw a "dot" as a Marker
on the map at the user's locationtrackUserLocation
. When in active lock the camera will update to follow the user location, however if the camera is changed by the API or UI then the control will enter the background state where it won't update the camera to follow the user location.fitBoundsOptions
to control the camera operationtrackuserlocationstart
and trackuserlocationend
eventsLngLat.toBounds
method to extend a point location by a given radius to a LngLatBounds
objectpackage.json
#4809, @tomscholzline-width
#4773text-anchor
#4997text-justify
#5000maxTileCacheSize
option #4778, @jczaplewicon-pitch-alignment
and circle-pitch-alignment
properties #4869 #4871Map#getMaxBounds
method #4890, @andrewharvey @lamuertepeludalocalIdeographFontFamily
) to use TinySDF to avoid loading expensive CJK glyphs #4895config.API_URL
includes a path prepend it to the request URL #4995supercluster
version to expose cluster_id
property on clustered sources #5002FullscreenControl
on unsupported devices #4838, @stepankuzminloadData
to the same worker every time #4877load
#4870LogoControl
logic to update correctly, and hide the <div>
instead of removing it from the DOM when it is not needed #4842GeoJSONSource#serialize
to include all optionsGlyphSource#getSimpleGlyphs
#4992setStyle
to reload raster tiles #4852Map#queryRenderedFeatures
would error when returning no results #4993Map#areTilesLoaded
would always be false on sourcedata
events for reloading tiles #4987package.json
#4819 @tomscholzwebglcontextlost
event #4725 @cdawiflyTo
to within the map's specified min- and maxzoom to prevent undefined behavior #4726 @ IvanSanchezflyTo
calls #4761queryRenderedSymbols
logic to better account for pitch scaling #4792text-keep-upright
after text-offset
to keep labels upright when intended #4779 [Potentially breaking :warning: but considered a bugfix]aria-label
to popup close button #4799 @andrewharveypitchWithRotate
option #4800 @simastLngLat#wrapToBestWorld
Map#isStyleLoaded
and Map#areTilesLoaded
events #4321file:
protocol #4649 @oscarfontsMap#addImage
#4644mapboxgl-
prefix on all classes #4584 @asantos3026fill_outline
shaders #4600Camera#easeTo
interpolation on pitched maps #4540property
's type #4614style.json
in integration testsgl-style-composite
is now executable in line with the other tools @andrewharvey #4595gl-style-composite
utility now throws an error if a name conflict would occur between layers @andrewharvey #4595.json
extension to style-spec require
statements for webpack compatibility #4563 @orangemugMap#fitBounde
#4569 @andrewharveyid
field. #4581pitchstart
and pitchend
events #2449layers
parameter to Map#on
#1002text-offset
#4495text-rotate
#3516icon-image
#4304{text,icon}-size
#4455GeoJSONSource#setData()
could cause unnecessary DOM updates #4447Map#flyTo
did not respect the renderWorldCopies
setting #4449addImage
api #4531shift+zoom
#3334refreshedExpiredTiles
option #4549bounds
property #1775Map#addImage
and Map#removeImage
API to allow adding icon images at runtime #4404queryRenderedFeatures
to fail in cases where both multiple sources and data-driven paint properties were present #4417map.loaded()
to incorrectly return false
#4425type='button'
to FullscreenControl
to prevent button from acting as a form submit #4397Ctrl
key is released before the click during a DragRotate
event #4389options.easing
description from the Map#fitBounds
documentation #4402maxZoom
from 20 to 22 #4333tiledata
and tiledataloading
events in favor of sourcedata
and sourcedataloading
. #4347mapboxgl.util
is no longer exported #1408"type": "categorical"
is now required for all categorical functions. Previously, some forms of "implicitly" categorical functions worked, and others did not. #3717Map#fitBounds
to accept different values for top, bottom, left, and right padding
#3890FullscreenControl
for displaying a fullscreen map #3977MapDataEvent#isSourceLoaded
always returned false #4254MapEventData
is passed through on calls Map#flyTo
#4342Map#isMoving
#4350$id
in filters #4236 #4237layers
parameter to queryRenderedFeatures
#4331minZoom
and maxZoom
values #4324src/style-spec
and test/unit/style-spec
).mapbox-gl-rtl-text
plugin to not work #4055Map#isSourceLoaded
method #4033Expires
and Cache-Control
HTTP headers #3944around=center
option to scrollZoom
and touchZoomRotate
interaction handlers #3876mapbox-gl-rtl-text
plugin to support right-to-left scripts #3758canvas
source type #3765Map#isMoving
method #2792renderWorldCopies
option to the Map
constructor to give users control over whether multiple worlds are rendered in a map #3885Map
pitch or bearing is changed #3938undefined
source #3903mapbox-gl-test-suite
into this repository #3834gl.MAX_RENDERBUFFER_SIZE
#2893geojson
source and specifies a source-layer
#3896Map#setStyle
performance in some cases #3853showTileBoundaries
with no sources #3849Map#setStyle
smoothly transition to the new style #3621styledata
, sourcedata
, styledataloading
, and sourcedataloading
eventsisSourceLoaded
and source
properties to MapDataEvent
#3590circle-stroke-*
style properties #3672container
element doesn't exist #3719watchPosition
option to GeolocateControl
#3739positionOptions
option to GeolocateControl
#3739aria-label
to map canvas #3782icon-offset
#3791Map#removeSource
#3602gl-matrix
#3734line-color
property functions #3639Map#fitBounds
#3655Map#setStyle
#3829Map
from emitting a contextmenu
event on Windows browsers #3822Map#addLayer
and Map#removeLayer
#3584Map#moveLayer
#3584fill-opacity
rendering when using a fill-pattern
#3598AssertionErrors
from pitching raster layers by only calling Worker#redoPlacement
on vector and GeoJSON sources #3624fill-extrude-height
and fill-extrude-base
properties of fill
render type with a separate fill-extrusion
type (with corresponding fill-extrusion-height
and fill-extrusion-base
properties), solving problems with render parity and runtime switching between flat and extruded fills. https://github.com/mapbox/mapbox-gl-style-spec/issues/554fill-extrusion-height
, fill-extrusion-base
) from "magic numbers" to meters. #3509mapboxgl.Control
class and change the way custom controls should be implemented. #3497mapboxgl.util
functions: inherit
, extendAll
, debounce
, coalesce
, startsWith
, supportsGeolocation
. #3441 #3571mapboxgl.util
is deprecated and will be removed in the next release. #1408mapboxgl.workerCount
) for better performance. #3565categorical
style function type when input values are strings. #3384https
). #3571Map#getMaxZoom
and Map#getMinZoom
methods #3592background
layers. #3521raster-fade-duration
property. #35320
). #3463queryRenderedFeatures
working incorrectly on colliding labels. #3459map.loaded()
always returned true
when using raster tile sources. #3302failed to invert matrix
error. #3518queryRenderedFeatures
throwing an error if no parameters provided. #3542\n
in a text field resulted in an error. #3570npm install mapbox-gl
pulling in all devDependencies
, leading to an extremely slow install. #3377fill-extrude-height
and fill-extrude-base
style properties (3d buildings) :cityscape: #3223colorSpace
interpolation to functions #3245identity
function type #3274'pitch-alignment': 'map'
#3243dataloading
events for styles and sources #3306Control
suffix to all controls :warning: BREAKING CHANGE :warning: #3355ref
s automatically and get rid of user-specified ref
s :warning: BREAKING CHANGE :warning: #3486Marker#setLngLat
is called #3294touchend
on Android Chrome #3319tile
property to data
events fired when a tile is removed #3328Evented#off
now require two arguments; omitting the second argument in order to unbind all listeners for an event
type is no longer supported, as it could cause unintended unbinding of internal listeners.data
and dataloading
events (#3255)auto
value for style spec properties (#3203)LngLat#convert
(#3232)tiles
field is omitted from the RasterTileSource#serialize
method (#3259)div
within the Navigation
control <button>
with a span
element (#3268)Marker
instances to be translated to non-whole pixel coordinates that caused blurriness (#3270)mapbox://
URLs #3113Worker
script Blob
size #3158package.json
#3174text-field
#3179Map#queryRenderedFeatures
on nonexistent layer #3196Scale
control #3160Map#getBounds
#3081Map#setFilter
and map rotation on iOS 10 #3207line-color
property functions #2938Scale
control #2940 #3042Popup
offset
option #1962Marker#bindPopup
method #3056WebWorker
pool #2952LatLngBounds
obey its documented argument order (southwest
, northeast
), allowing bounds across the dateline #2414 :warning: BREAKING CHANGE :warning:fill-opacity
property functions to not render as expected #3061Map#querySourceFeatures
#3022Map#loaded
to return true while there are outstanding tile updates #2847GeoJSONSource
, VideoSource
, ImageSource
constructors are now private. Please use map.addSource({...})
to create sources and map.getSource(...).setData(...)
to update GeoJSON sources. #2667Map#onError
has been removed. You may catch errors by listening for the error
event. If no listeners are bound to error
, error messages will be printed to the console. #2852$id
#2888close
event to Popup
s #2953offset
option to Marker
#2885error
events without any listeners to the console #2852Source
interface to prepare for custom source types #2667DataCloneError
in Firefox and IE11 #2559moveend
listeners #2944fill-outline-color
from being unset #2964line-offset
, reversing the direction of the offset. #2889text-pitch-alignment
style property #2668mapbox://
URLs #2702icon-text-fit
and icon-text-fit-padding
style properties #2720icon-rotate
#2738fill-opacity
#2733Map#mouseout
events #2777Marker
class #2725 #2810{quadkey}
URL parameter #2805circle-pitch-scale
style property #2821Map#loaded
returning true while there are outstanding tile updates #2847queryRenderedFeatures
in Safari and Firefox #2822mapboxgl#supported()
returning true
in old versions of IE11 mapbox/mapbox-gl-supported#1*-translate
properties via setPaintProperty
(#2762)workerCount
constructor option #2666locationPoint
and pointLocation
#2690version
property to mapboxgl #2660circle-opacity
and circle-blur
#2693queryRenderedFeatures
#2694fill-color
and fill-outline-color
#2629has
and !has
filter operators mapbox/feature-filter#15trackResize
option to Map
#2591fill-pattern
from a fill layer #2534line-pattern
and fill-pattern
rendering #2596queryRenderedFeatures
before the map is loaded #2621circle-color
and circle-size
#2454Map#setFilter
#2495map.batch
in favor of automatically batching style mutations (i.e. calls to Map#setLayoutProperty
, Map#setPaintProperty
, Map#setFilter
, Map#setClasses
, etc.) and applying them once per frame, significantly improving performance when updating the style frequently #2355 #2380util.throttle
#2345Map#queryRenderedFeatures
and Map#querySourceFeatures
#2349circle-color
and circle-size
#1932Popup#setDOMContent
method #2436WebWorker
instead of # cpus - 1
WebWorker
s, slowing down tile loading times #2408Map#queryRenderedFeatures
would sometimes return features that had been removed #2353clusterMaxZoom
option on GeoJSONSource
not working as expected #2374Map#queryRenderedFeatures
or Map#querySourceFeatures
with no argumentsMap#setLayoutProperty
for text-field
or icon-image
#2407Map#featuresAt
and Map#featuresIn
with Map#queryRenderedFeatures
and map.querySourceFeatures
(#2224)featuresAt
and featuresIn
with queryRenderedFeatures
queryRenderedFeatures
synchronous, remove the callback and use the return value.layer
parameter to layers
and make it an array of layer names.radius
parameter. radius
was used with featuresAt
to account for style properties like line-width
and circle-radius
. queryRenderedFeatures
accounts for these style properties. If you need to query a larger area, use a bounding box query instead of a point query.includeGeometry
parameter because queryRenderedFeatures
always includes geometries.Map#debug
is renamed to Map#showTileBoundaries
(#2284)Map#collisionDebug
is renamed to Map#showCollisionBoxes
(#2284)GeoJSONSource#setData
. (#2222)Map#setMaxBounds
method (#2234)isActive
and isEnabled
methods to interaction handlers (#2238)Map#setZoomBounds
method (#2243)map.queryRenderedFeatures
to query the styled and rendered representations of features (#2224)map.querySourceFeatures
to get features directly from vector tiles, independent of the style (#2224)mapboxgl.Geolocate
control (#1939)setFilter
, setLayoutProperty
, and setLayerZoomRange
on ref children (#2228)undefined
bucket errors after setFilter
calls (#2244)queryRenderedFeatures
precision at high zoom levels (#2292)queryRenderedFeatures
(#2306)ImageSource#setCoordinates
and VideoSource#setCoordinates
(#2184)setData
(#2174)in
feature filter drops features (#2166)Map#load
from firing when tile "Not Found" errors occured (#2176)tileSize: 512
as a switch to trade retina support for 512px raster tilesGeoJSONSource
clustering options from being measured in extent-units to pixels (#2026)filter
performance and maximum size (#2024)Map#getStyle
method (#1982)mapboxgl.supported()
(#2018)minzoom
setting for GeoJSON sources (#1651)performance.now
not being present on some browsers (#2056)Tile#buffers
errors (#1987)symbol-avoid-edges
style property (#1951)symbol-max-angle
check algorithm (#1959)Popup#addTo
when the popup is already open (#1811)Map#flyTo
now flies across the antimeridan if shorter (#1853)line-offset
(#1808)Pinch
interaction handler to TouchZoomRotate
(#1777)Map#update
and Map#render
private methods (#1798)Map#remove
remove created DOM elements (#1789)position
option for Attribution
(#1689)line-offset
style property (#1778)mouseend
events (#1104)mousedown
and mouseup
events (#1411)movestart
and moveend
when panning (#1658)devicePixelRatio
s (#1029 #1475 #1476)raster-opacity
on non-tile sources (#1270)Transform#resize
methodMap#getLayer
method (#1183)Transform#unmodified
property (#1452)Map#featuresAt
for non-4096 vector sources (#1529)mousemove
on drag-panTileCoord
, fix wrap calculation in TileCoord#cover
(#1483)Map
event listeners for mouseup
, contextmenu
(right click) (#1532)Map#featuresIn
: a bounding-box feature querycenter
, zoom
, bearing
, pitch
(#1452)text-size
via setLayoutProperty
(#1451)The following APIs were renamed:
* `LatLng` was renamed to `LngLat`
* `LatLngBounds` was renamed to `LngLatBounds`
* `Popup#setLatLng` was renamed to `Popup#setLngLat`
* `Popup#getLatLng` was renamed to `Popup#getLngLat`
* The `latLng` property of Map events was renamed `lngLat`
The following APIs now expect array coordinates in [longitude, latitude] order:
* `LngLat.convert`
* `LngLatBounds.convert`
* `Popup#setLngLat`
* The `center` and `maxBounds` options of the `Map` constructor
* The arguments to `Map#setCenter`, `Map#fitBounds`, `Map#panTo`, and `Map#project`
* The `center` option of `Map#jumpTo`, `Map#easeTo`, and `Map#flyTo`
* The `around` option of `Map#zoomTo`, `Map#rotateTo`, and `Map#easeTo`
* The `coordinates` properties of video and image sources
Updated to mapbox-gl-style-spec v8.0.0 (Changelog). Styles are now expected to be version 8. You can use the gl-style-migrate utility to update existing styles.
The format for mapbox://
style and glyphs URLs has changed. For style URLs, you should now use the format
mapbox://styles/:username/:style
. The :style
portion of the URL no longer contains a username. For font URLs, you
should now use the format mapbox://fonts/:username/{fontstack}/{range}.pbf
.
mapbox://
style URL pointing to a v8 style, e.g. mapbox://styles/mapbox/streets-v8
.The v8 satellite style (mapbox://styles/mapbox/satellite-v8
) is now a plain satellite style, and not longer supports labels
or contour lines via classes. For a labeled satellite style, use mapbox://styles/mapbox/satellite-hybrid
.
Removed mbgl.config.HTTP_URL
and mbgl.config.FORCE_HTTPS
; https is always used when connecting to the Mapbox API.
mbgl.config.HTTPS_URL
to mbgl.config.API_URL
.setLayoutProperty
and setPaintProperty
APIs
by passing undefined
as a property value.layer
option of featuresAt
now supports an array of layers.glyphs
URL now normalizes without the /v4/
prefix for mapbox://
urls. Legacy behavior for mapbox://fontstacks
is still maintained (#1385)geojson-vt
options for GeoJSON sources (#1271)map.setLayerZoomRange(layerId, minzoom, maxzoom)
mapboxgl.Control
, a base class used by all UI controlsmap.scrollZoom.disable()
.js
style.batch(function(s) {
s.addLayer({ id: 'first', type: 'symbol', source: 'streets' });
s.addLayer({ id: 'second', type: 'symbol', source: 'streets' });
s.addLayer({ id: 'third', type: 'symbol', source: 'terrain' });
s.setPaintProperty('first', 'text-color', 'black');
s.setPaintProperty('first', 'text-halo-color', 'white');
});
Improved documentation
featuresAt
performance improvements by exposing includeGeometry
option
Better label placement along lines (#1283)
Improvements to round linejoins on semi-transparent lines (mapbox/mapbox-gl-native#1771)
Round zoom levels for raster tile loading (2a2aec)
Source#reload cannot be called if source is not loaded (#1198)
Events bubble to the canvas container for custom overlays (#1301)
Move handlers are now bound on mousedown and touchstart events
* map.featuresAt() now works across the dateline
map.setView(latlng, zoom, bearing)
has been removed. Use
map.jumpTo(options)
instead:js
map.setView([40, -74.50], 9) // 0.7.0 or earlier
map.jumpTo({center: [40, -74.50], zoom: 9}); // now
* map.easeTo
and
map.flyTo
now accept a single
options object rather than positional parameters:
js
map.easeTo([40, -74.50], 9, null, {duration: 400}); // 0.7.0 or earlier
map.easeTo({center: [40, -74.50], zoom: 9, duration: 400}); // now
mapboxgl.Source
is no longer exported. Use map.addSource()
instead. See the
GeoJSON line or
GeoJSON markers
examples.
mapboxgl.util.supported()
moved to mapboxgl.supported()
.
Map
setPitch
getPitch
Map
dblclick
event. (#1168)Map
getSource
(660a8c1)Map
setFilter
and getFilter
(#985)Map
failIfMajorPerformanceCaveat
option (#1082)Map
preserveDrawingBuffer
option (#1232)VideoSource
getVideo()
(#1162)latLng
to the event object (#1068)moveend
events on mouseup (#1107)featuresAt
(#1220)Popup
setHTML
(#1272)Map
hover
event to mousemove
.featuresAt
to return GeoJSON objects, including geometry (#1010)Map
canvas
and container
properties, add getCanvas
and getContainer
methods insteadGeoJSONSource
setData
without flickering (#973)addSource
(#1021)featuresAt
for LineStrings (#1006)tileSize
argument to GeoJSON
worker (#987)map.setPaintProperty()
, map.getPaintProperty()
, map.setLayoutProperty()
, and map.getLayoutProperty()
./v4
path prefix.addClass
, removeClass
, setClasses
, hasClass
, and getClasses
are now methods
on Map.Style#cascade
is now private, pending a public style mutation API (#755).featuresAt
results changed. Instead of result-per-geometry-cross-layer,
each result has a layers
array with all layers that contain the feature. This avoids
duplication of geometry and properties in the result set.featuresAt
now returns additional informationfeaturesAt
changedraster-hue-rotate
units are now degrees.symbol-avoid-edges
property to allow labels to be placed across tile edges.raster-opacity
for regular raster layers.map.setBearing()
no longer supports a second argument. Use map.rotateTo
with an offset
option and duration 0
if you need to rotate around a point other than the map center.GeoJSONSource
to also accept URL as data
option, eliminating a huge performance bottleneck in case of large GeoJSON files.
#669 #671around
option to Map
zoomTo
/rotateTo
.util.supports
WebGL detection producing false positives in some cases. #677Map
project
/unproject
to properly accept array-form values.GeoJSONSource
setData
not updating the map until zoomed or panned. #676Navigation
control signature: now it doesn't need map
in constructor
and gets added with map.addControl(nav)
or nav.addTo(map)
.mapboxgl-
.attributionControl: false
in options).util.inherit
and util.debounce
functions.Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.