MapOptions class

Constructors

MapOptions({dynamic hash, bool? interactive, dynamic container, num? bearingSnap, bool? pitchWithRotate, bool? clickTolerance, bool? attributionControl, dynamic customAttribution, String? logoPosition, bool? failIfMajorPerformanceCaveat, bool? preserveDrawingBuffer, bool? antialias, bool? refreshExpiredTiles, LngLatBounds? maxBounds, bool? scrollZoom, num? minZoom, num? maxZoom, num? minPitch, num? maxPitch, dynamic style, bool? boxZoom, bool? dragRotate, dynamic dragPan, bool? keyboard, bool? doubleClickZoom, bool? touchZoomRotate, bool? trackResize, LngLat? center, num? zoom, num? bearing, num? pitch, LngLatBounds? bounds, dynamic fitBoundsOptions, bool? renderWorldCopies, num? maxTileCacheSize, String? localIdeographFontFamily, RequestTransformFunctionJsImpl? transformRequest, bool? collectResourceTiming, num? fadeDuration, bool? crossSourceCollisions, String? accessToken, dynamic locale})
factory
MapOptions.fromJsObject(MapOptionsJsImpl jsObject)
Creates a new MapOptions from a jsObject.

Properties

accessToken String
If specified, map will use this token instead of the one defined in accessToken.
no setter
antialias bool
If true, the gl context will be created with MSAA antialiasing, which can be useful for antialiasing custom layers. this is false by default as a performance optimization.
no setter
attributionControl bool
If true, an {@link AttributionControl} will be added to the map.
no setter
bearing num
The initial bearing (rotation) of the map, measured in degrees counter-clockwise from north. If bearing is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to 0.
no setter
bearingSnap num
The threshold, measured in degrees, that determines when the map's bearing will snap to north. For example, with a bearingSnap of 7, if the user rotates the map within 7 degrees of north, the map will automatically snap to exact north.
no setter
bounds LngLatBounds
The initial bounds of the map. If bounds is specified, it overrides center and zoom constructor options.
no setter
boxZoom bool
If true, the "box zoom" interaction is enabled (see {@link BoxZoomHandler}).
no setter
center LngLat
The inital geographical centerpoint of the map. If center is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to [0, 0] Note: Mapbox GL uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match GeoJSON.
no setter
clickTolerance num
The max number of pixels a user can shift the mouse pointer during a click for it to be considered a valid click (as opposed to a mouse drag).
no setter
collectResourceTiming bool
If true, Resource Timing API information will be collected for requests made by GeoJSON and Vector Tile web workers (this information is normally inaccessible from the main Javascript thread). Information will be returned in a resourceTiming property of relevant data events.
no setter
container → dynamic
The HTML element in which Mapbox GL JS will render the map, or the element's string id. The specified element must have no children. HTMLElement or String
no setter
crossSourceCollisions bool
If true, symbols from multiple sources can collide with each other during collision detection. If false, collision detection is run separately for the symbols in each source.
no setter
customAttribution → dynamic
String or strings to show in an {@link AttributionControl}. Only applicable if options.attributionControl is true. String or List<String>
no setter
doubleClickZoom bool
If true, the "double click to zoom" interaction is enabled (see {@link DoubleClickZoomHandler}).
no setter
dragPan → dynamic
If true, the "drag to pan" interaction is enabled. An Object value is passed as options to {@link DragPanHandler#enable}.
no setter
dragRotate bool
If true, the "drag to rotate" interaction is enabled (see {@link DragRotateHandler}).
no setter
fadeDuration num
Controls the duration of the fade-in/fade-out animation for label collisions, in milliseconds. This setting affects all symbol layers. This setting does not affect the duration of runtime styling transitions or raster tile cross-fading.
no setter
failIfMajorPerformanceCaveat bool
If true, map creation will fail if the performance of Mapbox GL JS would be dramatically worse than expected (i.e. a software renderer would be used).
no setter
fitBoundsOptions → dynamic
A fitBounds options object to use only when fitting the initial bounds provided above.
no setter
hash → dynamic
If true, the map's position (zoom, center latitude, center longitude, bearing, and pitch) will be synced with the hash fragment of the page's URL. For example, http://path/to/my/page.html#2.59/39.26/53.07/-24.1/60. An additional string may optionally be provided to indicate a parameter-styled hash, e.g. http://path/to/my/page.html#map=2.59/39.26/53.07/-24.1/60&foo=bar, where foo is a custom parameter and bar is an arbitrary hash distinct from the map hash. bool or String
no setter
hashCode int
The hash code for this object.
no setterinherited
interactive bool
If false, no mouse, touch, or keyboard listeners will be attached to the map, so it will not respond to interaction.
no setter
jsObject → MapOptionsJsImpl
JS object.
finalinherited
keyboard bool
If true, keyboard shortcuts are enabled (see {@link KeyboardHandler}).
no setter
locale → dynamic
A patch to apply to the default localization table for UI strings, e.g. control tooltips. The locale object maps namespaced UI string IDs to translated strings in the target language; see src/ui/default_locale.js for an example with all supported string IDs. The object may specify all UI strings (thereby adding support for a new translation) or only a subset of strings (thereby patching the default translation table).
no setter
localIdeographFontFamily String
Defines a CSS font-family for locally overriding generation of glyphs in the 'CJK Unified Ideographs', 'Hiragana', 'Katakana' and 'Hangul Syllables' ranges. In these ranges, font settings from the map's style will be ignored, except for font-weight keywords (light/regular/medium/bold). Set to false, to enable font settings from the map's style for these glyph ranges. Note that Mapbox Studio sets this value to false by default. The purpose of this option is to avoid bandwidth-intensive glyph server requests. (See Use locally generated ideographs.)
no setter
logoPosition String
A string representing the position of the Mapbox wordmark on the map. Valid options are top-left,top-right, bottom-left, bottom-right.
no setter
maxBounds LngLatBounds
If set, the map will be constrained to the given bounds.
no setter
maxPitch num
The maximum pitch of the map (0-60).
no setter
maxTileCacheSize num
The maximum number of tiles stored in the tile cache for a given source. If omitted, the cache will be dynamically sized based on the current viewport.
no setter
maxZoom num
The maximum zoom level of the map (0-24).
no setter
minPitch num
The minimum pitch of the map (0-60).
no setter
minZoom num
The minimum zoom level of the map (0-24).
no setter
pitch num
The initial pitch (tilt) of the map, measured in degrees away from the plane of the screen (0-60). If pitch is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to 0.
no setter
pitchWithRotate bool
If false, the map's pitch (tilt) control with "drag to rotate" interaction will be disabled.
no setter
preserveDrawingBuffer bool
If true, the map's canvas can be exported to a PNG using map.getCanvas().toDataURL(). This is false by default as a performance optimization.
no setter
refreshExpiredTiles bool
If false, the map won't attempt to re-request tiles once they expire per their HTTP cacheControl/expires headers.
no setter
renderWorldCopies bool
If true, multiple copies of the world will be rendered side by side beyond -180 and 180 degrees longitude. If set to false:
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollZoom bool
If true, the "scroll to zoom" interaction is enabled. An Object value is passed as options to {@link ScrollZoomHandler#enable}.
no setter
style → dynamic
The map's Mapbox style. This must be an a JSON object conforming to the schema described in the Mapbox Style Specification, or a URL to such JSON.
no setter
touchZoomRotate bool
If true, the "pinch to rotate and zoom" interaction is enabled. An Object value is passed as options to {@link TouchZoomRotateHandler#enable}.
no setter
trackResize bool
If true, the map will automatically resize when the browser window resizes.
no setter
transformRequest → RequestTransformFunctionJsImpl
A callback run before the MapboxMap makes a request for an external URL. The callback can be used to modify the url, set headers, or set the credentials property for cross-origin requests. Expected to return an object with a url property and optionally headers and credentials properties.
no setter
zoom num
The initial zoom level of the map. If zoom is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to 0.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited