mapStyle
String
, Object
options.style
in Mapcontainer
String
, HTMLElement
#map-{random number}
options.container
in MapaccessToken
String
undefined
minZoom
Number
0
options.minZoom
in MapmaxZoom
Number
22
options.maxZoom
in Maphash
Boolean
false
options.hash
in Mapinteractive
Boolean
true
options.interactive
in MapbearingSnap
Number
7
options.bearingSnap
in MapattributionControl
Boolean
true
options.attributionControl
in MaplogoPosition
String
, top-left
, top-right
, bottom-right
, bottom-left
bottom-left
options.logoPosition
in MapfailIfMajorPerformanceCaveat
Boolean
false
options.failIfMajorPerformanceCaveat
in MapcrossSourceCollisions
Boolean
true
options.crossSourceCollisions
in MapfadeDuration
Number
300
options.fadeDuration
in MappreserveDrawingBuffer
Boolean
false
options.preserveDrawingBuffer
in MaprefreshExpiredTiles
Boolean
true
options.refreshExpiredTiles
in MapmaxBounds
Array
, LngLatBoundsLike object
undefined
options.maxBounds
in MapscrollZoom
Boolean
, Object
true
options.scrollZoom
in MapboxZoom
Boolean
true
options.boxZoom
in MapdragRotate
Boolean
true
options.dragRotate
in Mapkeyboard
Boolean
true
options.keyboard
in MapdoubleClickZoom
Boolean
true
options.doubleClickZoom
in MaptouchZoomRotate
Boolean
, Object
true
options.touchZoomRotate
in MaptrackResize
Boolean
true
options.trackResize
in Mapcenter
Array, LngLatLike Object
undefined
[0, 0]
options.center
in Mapzoom
Number
undefined
0
options.zoom
in Mapbearing
Number
undefined
0
options.bearing
in Mappitch
Number
undefined
0
options.pitch
in MaprenderWorldCopies
Boolean
true
options.renderWorldCopies
in Maplight
Object
undefined
tileBoundaries
Boolean
false
collisionBoxes
Boolean
false
repaint
Boolean
false
transformRequest
Function
null
url
property and optionally headers
and credentials
properties.options.transformRequest
in MaplocalIdeographFontFamily
String
null
options.localIdeographFontFamily
in Map.stop()
{Promise<{ pitch, zoom, bearing, center }>}
Promise that resolves object with map parameters on the moment of call stop()
.supported(perfomanceCheck = false)
.resize()
.project(mapCoordinates)
.unproject(containerCoordinates)
.queryRenderedFeatures(geometry?, parameters?)
.querySourceFeatures(sourceId, parameters?)
.getFeatureState(feature?)
.setFeatureState(feature?, state)
.addImage(name, image, options)
.removeImage(name)
.loadImage(url, callback)
.hasImage(id)
.panBy(offset, options)
offset
{Point | number[]}
x and y coordinates by which to pan the mapoptions
{AnimationOptions object}
animation options. See AnimationOptions{Promise<{ eventData, center }>}
Promise that resolves object with event data and new center of the map when animation ends.panTo(coordinates, options)
coordinates
{LngLat | number[][]}
The location to pan the map to. See also: LngLatoptions
{AnimationOptions object}
animation options. See AnimationOptions{Promise<{ eventData, center }>}
Promise that resolves object with event data and new center of the map when animation ends.zoomTo(zoom, options)
zoom
{number}
The zoom level to transition tooptions
{AnimationOptions object}
animation options. See AnimationOptions{Promise<{ eventData, zoom }>}
Promise that resolves object with event data and new zoom level of the map when animation ends.zoomIn(options)
options
{AnimationOptions object}
animation options. See AnimationOptions{Promise<{ eventData, zoom }>}
Promise that resolves object with event data and new zoom level of the map when animation ends.zoomOut(options)
options
{AnimationOptions object}
animation options. See AnimationOptions{Promise<{ eventData, zoom }>}
Promise that resolves object with event data and new zoom level of the map when animation ends.rotateTo(bearing, options)
bearing
{number}
The desired bearingoptions
{AnimationOptions object}
animation options. See AnimationOptions{Promise<{ eventData, bearing }>}
Promise that resolves object with event data and new bearing of the map when animation ends.resetNorth(options)
options
{AnimationOptions object}
animation options. See AnimationOptions{Promise<{ eventData, bearing }>}
Promise that resolves object with event data and new bearing of the map when animation ends.snapToNorth(options)
options
{AnimationOptions object}
animation options. See AnimationOptionsbearingSnap
prop threshold).{Promise<{ eventData, bearing }>}
Promise that resolves object with event data and new bearing of the map when animation ends.fitBounds(bounds, options)
bounds
{ number[][] | LngLatBounds }
Center these bounds in the viewport and use the highest zoom level up to and including maxZoom
that fits them in the viewportoptions
{Object}
options.padding?
{number}
The amount of padding in pixels to add to the given boundsoptions.linear
{boolean}
default: false
If true , the map transitions using Map#easeTo
. If false , the map transitions using Map#flyTo
. See those functions and AnimationOptions for information about options available.options.easing?
An easing function for the animated transition. See AnimationOptionsoptions.offset
{ number[] | Point }
default: [0, 0]
The center of the given bounds relative to the map's center, measured in pixelsoptions.maxZoom?
{number}
The maximum zoom level to allow when the map view transitions to the specified bounds{Promise<{ eventData, bounds }>}
Promise that resolves object with event data and new bounds of the map when animation ends.cameraForBounds(bounds, options)
.jumpTo(options)
options
{Object}
See CameraOptions options.pitch?
{number}
The desired pitch, in degreesoptions.zoom?
{number}
The desired zoom leveloptions.center?
{number[] | LngLat}
The desired centeroptions.bearing?
{number}
The desired bearing, in degreesoptions.around?
{number[] | LngLat}
If zoom
is specified, around
determines the point around which the zoom is centered.{Promise<{ eventData, pitch, zoom, center, bearing }>}
Promise that resolves object with event data and new pitch, zoom, center and bearing of the map.easeTo(options)
options
{Object}
Combination of CameraOptions and AnimationOptions
options.pitch?
{number}
The desired pitch, in degreesoptions.zoom?
{number}
The desired zoom leveloptions.center?
{number[] | LngLat}
The desired centeroptions.bearing?
{number}
The desired bearing, in degreesoptions.around?
{number[] | LngLat}
If zoom
is specified, around
determines the point around which the zoom is centered.options.duration?
{number}
The animation's duration, measured in milliseconds.options.easing?
{Function}
A function taking a time in the range 0..1 and returning a number where 0 is the initial state and 1 is the final state.options.offset?
{number[] | Point}
of the target center relative to real map container center at the end of animation.options.animate?
{boolean}
: If false
, no animation will occuroptions
{Promise<{ eventData, pitch, zoom, center, bearing }>}
Promise that resolves object with event data and new pitch, zoom, center and bearing of the map when animations ends.flyTo(options)
options
{Object}
options.curve?
{number}
default 1.42
The zooming "curve" that will occur along the flight path. A high value maximizes zooming for an exaggerated animation, while a low value minimizes zooming for an effect closer to Map#easeTo. 1.42 is the average value selected by participants in the user study discussed in van Wijk (2003). A value of Math.pow(6, 0.25) would be equivalent to the root mean squared average velocity. A value of 1 would produce a circular motionoptions.minZoom?
{number}
The zero-based zoom level at the peak of the flight path. If options.curve
is specified, this option is ignoredoptions.speed?
{number}
default 1.2
The average speed of the animation defined in relation to options.curve
. A speed of 1.2 means that the map appears to move along the flight path by 1.2 times options.curve
screenfuls every second. A screenful is the map's visible span. It does not correspond to a fixed physical distance, but varies by zoom leveloptions.screenSpeed?
{number}
The average speed of the animation measured in screenfuls per second, assuming a linear timing curve. If options.speed
is specified, this option is ignoredoptions.maxDuration?
{number}
The animation's maximum duration, measured in milliseconds. If duration exceeds maximum duration, it resets to 0{Promise<{ eventData, pitch, zoom, center, bearing }>}
Promise that resolves object with event data and new pitch, zoom, center and bearing of the map when animations ends@load
{ map, component }
map
is Mapbox Gl JS Map object, component
is instance of GlMap componentGlMap passes all Mapbox GL JS Map events. Full list of map events see here