UNPKG

99.1 kBTypeScriptView Raw
1/// <reference types="geojson" />
2
3export = mapboxgl;
4export as namespace mapboxgl;
5
6declare namespace mapboxgl {
7 let accessToken: string;
8 let version: string;
9 let baseApiUrl: string;
10
11 /**
12 * Number of web workers instantiated on a page with GL JS maps.
13 * By default, it is set to half the number of CPU cores (capped at 6).
14 */
15 let workerCount: number;
16
17 /**
18 * Maximum number of images (raster tiles, sprites, icons) to load in parallel, which affects performance in raster-heavy maps.
19 * 16 by default.
20 */
21 let maxParallelImageRequests: number;
22
23 export function supported(options?: { failIfMajorPerformanceCaveat?: boolean | undefined }): boolean;
24
25 /**
26 * Clears browser storage used by this library. Using this method flushes the Mapbox tile cache that is managed by this library.
27 * Tiles may still be cached by the browser in some cases.
28 */
29 export function clearStorage(callback?: (err?: Error) => void): void;
30
31 export function setRTLTextPlugin(pluginURL: string, callback: (error: Error) => void, deferred?: boolean): void;
32 export function getRTLTextPluginStatus(): PluginStatus;
33
34 /**
35 * Initializes resources like WebWorkers that can be shared across maps to lower load
36 * times in some situations. `mapboxgl.workerUrl` and `mapboxgl.workerCount`, if being
37 * used, must be set before `prewarm()` is called to have an effect.
38 *
39 * By default, the lifecycle of these resources is managed automatically, and they are
40 * lazily initialized when a Map is first created. By invoking `prewarm()`, these
41 * resources will be created ahead of time, and will not be cleared when the last Map
42 * is removed from the page. This allows them to be re-used by new Map instances that
43 * are created later. They can be manually cleared by calling
44 * `mapboxgl.clearPrewarmedResources()`. This is only necessary if your web page remains
45 * active but stops using maps altogether.
46 *
47 * This is primarily useful when using GL-JS maps in a single page app, wherein a user
48 * would navigate between various views that can cause Map instances to constantly be
49 * created and destroyed.
50 */
51 export function prewarm(): void;
52
53 /**
54 * Clears up resources that have previously been created by `mapboxgl.prewarm()`.
55 * Note that this is typically not necessary. You should only call this function
56 * if you expect the user of your app to not return to a Map view at any point
57 * in your application.
58 */
59 export function clearPrewarmedResources(): void;
60
61 type PluginStatus = "unavailable" | "loading" | "loaded" | "error";
62
63 type LngLatLike = [number, number] | LngLat | { lng: number; lat: number } | { lon: number; lat: number };
64
65 type LngLatBoundsLike = LngLatBounds | [LngLatLike, LngLatLike] | [number, number, number, number] | LngLatLike;
66 type PointLike = Point | [number, number];
67 type Offset = number | PointLike | { [_: string]: PointLike };
68
69 type ExpressionName =
70 // Types
71 | "array"
72 | "boolean"
73 | "collator"
74 | "format"
75 | "literal"
76 | "number"
77 | "number-format"
78 | "object"
79 | "string"
80 | "image"
81 | "to-boolean"
82 | "to-color"
83 | "to-number"
84 | "to-string"
85 | "typeof"
86 // Feature data
87 | "feature-state"
88 | "geometry-type"
89 | "id"
90 | "line-progress"
91 | "properties"
92 // Lookup
93 | "at"
94 | "get"
95 | "has"
96 | "in"
97 | "index-of"
98 | "length"
99 | "slice"
100 | "config"
101 // Decision
102 | "!"
103 | "!="
104 | "<"
105 | "<="
106 | "=="
107 | ">"
108 | ">="
109 | "all"
110 | "any"
111 | "case"
112 | "match"
113 | "coalesce"
114 | "within"
115 // Ramps, scales, curves
116 | "interpolate"
117 | "interpolate-hcl"
118 | "interpolate-lab"
119 | "step"
120 // Variable binding
121 | "let"
122 | "var"
123 // String
124 | "concat"
125 | "downcase"
126 | "is-supported-script"
127 | "resolved-locale"
128 | "upcase"
129 // Color
130 | "hsl"
131 | "hsla"
132 | "rgb"
133 | "rgba"
134 | "to-rgba"
135 // Math
136 | "-"
137 | "*"
138 | "/"
139 | "%"
140 | "^"
141 | "+"
142 | "abs"
143 | "acos"
144 | "asin"
145 | "atan"
146 | "ceil"
147 | "cos"
148 | "distance"
149 | "e"
150 | "floor"
151 | "ln"
152 | "ln2"
153 | "log10"
154 | "log2"
155 | "max"
156 | "min"
157 | "pi"
158 | "random"
159 | "round"
160 | "sin"
161 | "sqrt"
162 | "tan"
163 // Camera
164 | "distance-from-center"
165 | "pitch"
166 | "zoom"
167 | "raster-value"
168 // Lights
169 | "measure-light"
170 // Heatmap
171 | "heatmap-density";
172
173 type Expression = [ExpressionName, ...any[]];
174
175 type Anchor =
176 | "center"
177 | "left"
178 | "right"
179 | "top"
180 | "bottom"
181 | "top-left"
182 | "top-right"
183 | "bottom-left"
184 | "bottom-right";
185
186 type DragPanOptions = {
187 linearity?: number;
188 easing?: (t: number) => number;
189 deceleration?: number;
190 maxSpeed?: number;
191 };
192
193 type InteractiveOptions = { around?: "center" };
194
195 /**
196 * Map
197 */
198 export class Map extends Evented {
199 constructor(options?: MapboxOptions);
200
201 addControl(
202 control: Control | IControl,
203 position?: "top-right" | "top-left" | "bottom-right" | "bottom-left",
204 ): this;
205
206 removeControl(control: Control | IControl): this;
207
208 /**
209 * Checks if a control exists on the map.
210 *
211 * @param {IControl} control The {@link IControl} to check.
212 * @returns {boolean} True if map contains control.
213 * @example
214 */
215 hasControl(control: IControl): boolean;
216
217 resize(eventData?: EventData): this;
218
219 getBounds(): LngLatBounds;
220
221 getMaxBounds(): LngLatBounds | null;
222
223 setMaxBounds(lnglatbounds?: LngLatBoundsLike): this;
224
225 setMinZoom(minZoom?: number | null): this;
226
227 getMinZoom(): number;
228
229 setMaxZoom(maxZoom?: number | null): this;
230
231 getMaxZoom(): number;
232
233 setMinPitch(minPitch?: number | null): this;
234
235 getMinPitch(): number;
236
237 setMaxPitch(maxPitch?: number | null): this;
238
239 getMaxPitch(): number;
240
241 getRenderWorldCopies(): boolean;
242
243 setRenderWorldCopies(renderWorldCopies?: boolean): this;
244
245 project(lnglat: LngLatLike): mapboxgl.Point;
246
247 unproject(point: PointLike): mapboxgl.LngLat;
248
249 isMoving(): boolean;
250
251 isZooming(): boolean;
252
253 isRotating(): boolean;
254
255 /**
256 * Returns an array of GeoJSON Feature objects representing visible features that satisfy the query parameters.
257 *
258 * The properties value of each returned feature object contains the properties of its source feature. For GeoJSON sources, only string and numeric property values are supported (i.e. null, Array, and Object values are not supported).
259 *
260 * Each feature includes top-level layer, source, and sourceLayer properties. The layer property is an object representing the style layer to which the feature belongs. Layout and paint properties in this object contain values which are fully evaluated for the given zoom level and feature.
261 *
262 * Only features that are currently rendered are included. Some features will not be included, like:
263 *
264 * - Features from layers whose visibility property is "none".
265 * - Features from layers whose zoom range excludes the current zoom level.
266 * - Symbol features that have been hidden due to text or icon collision.
267 *
268 * Features from all other layers are included, including features that may have no visible contribution to the rendered result; for example, because the layer's opacity or color alpha component is set to 0.
269 *
270 * The topmost rendered feature appears first in the returned array, and subsequent features are sorted by descending z-order. Features that are rendered multiple times (due to wrapping across the antimeridian at low zoom levels) are returned only once (though subject to the following caveat).
271 *
272 * Because features come from tiled vector data or GeoJSON data that is converted to tiles internally, feature geometries may be split or duplicated across tile boundaries and, as a result, features may appear multiple times in query results. For example, suppose there is a highway running through the bounding rectangle of a query. The results of the query will be those parts of the highway that lie within the map tiles covering the bounding rectangle, even if the highway extends into other tiles, and the portion of the highway within each map tile will be returned as a separate feature. Similarly, a point feature near a tile boundary may appear in multiple tiles due to tile buffering.
273 *
274 * @param pointOrBox The geometry of the query region: either a single point or southwest and northeast points describing a bounding box. Omitting this parameter (i.e. calling Map#queryRenderedFeatures with zero arguments, or with only a options argument) is equivalent to passing a bounding box encompassing the entire map viewport.
275 * @param options
276 */
277 queryRenderedFeatures(
278 pointOrBox?: PointLike | [PointLike, PointLike],
279 options?: { layers?: string[] | undefined; filter?: any[] | undefined } & FilterOptions,
280 ): MapboxGeoJSONFeature[];
281
282 /**
283 * Returns an array of GeoJSON Feature objects representing features within the specified vector tile or GeoJSON source that satisfy the query parameters.
284 *
285 * In contrast to Map#queryRenderedFeatures, this function returns all features matching the query parameters, whether or not they are rendered by the current style (i.e. visible). The domain of the query includes all currently-loaded vector tiles and GeoJSON source tiles: this function does not check tiles outside the currently visible viewport.
286 *
287 * Because features come from tiled vector data or GeoJSON data that is converted to tiles internally, feature geometries may be split or duplicated across tile boundaries and, as a result, features may appear multiple times in query results. For example, suppose there is a highway running through the bounding rectangle of a query. The results of the query will be those parts of the highway that lie within the map tiles covering the bounding rectangle, even if the highway extends into other tiles, and the portion of the highway within each map tile will be returned as a separate feature. Similarly, a point feature near a tile boundary may appear in multiple tiles due to tile buffering.
288 *
289 * @param sourceID The ID of the vector tile or GeoJSON source to query.
290 * @param parameters
291 */
292 querySourceFeatures(
293 sourceID: string,
294 parameters?: {
295 sourceLayer?: string | undefined;
296 filter?: any[] | undefined;
297 } & FilterOptions,
298 ): MapboxGeoJSONFeature[];
299
300 setStyle(
301 style: mapboxgl.Style | string,
302 options?: { diff?: boolean | undefined; localIdeographFontFamily?: string | undefined },
303 ): this;
304
305 getStyle(): mapboxgl.Style;
306
307 isStyleLoaded(): boolean;
308
309 addSource(id: string, source: AnySourceData): this;
310
311 isSourceLoaded(id: string): boolean;
312
313 areTilesLoaded(): boolean;
314
315 removeSource(id: string): this;
316
317 getSource(id: string): AnySourceImpl;
318
319 addImage(
320 name: string,
321 image:
322 | HTMLImageElement
323 | ArrayBufferView
324 | { width: number; height: number; data: Uint8Array | Uint8ClampedArray }
325 | ImageData
326 | ImageBitmap,
327 options?: {
328 pixelRatio?: number | undefined;
329 sdf?: boolean | undefined;
330 stretchX?: Array<[number, number]> | undefined;
331 stretchY?: Array<[number, number]> | undefined;
332 content?: [number, number, number, number] | undefined;
333 },
334 ): void;
335
336 updateImage(
337 name: string,
338 image:
339 | HTMLImageElement
340 | ArrayBufferView
341 | { width: number; height: number; data: Uint8Array | Uint8ClampedArray }
342 | ImageData
343 | ImageBitmap,
344 ): void;
345
346 hasImage(name: string): boolean;
347
348 removeImage(name: string): void;
349
350 loadImage(url: string, callback: (error?: Error, result?: HTMLImageElement | ImageBitmap) => void): void;
351
352 listImages(): string[];
353
354 addLayer(layer: mapboxgl.AnyLayer, before?: string): this;
355
356 moveLayer(id: string, beforeId?: string): this;
357
358 removeLayer(id: string): this;
359
360 getLayer(id: string): mapboxgl.AnyLayer;
361
362 setFilter(layer: string, filter?: any[] | boolean | null, options?: FilterOptions | null): this;
363
364 setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this;
365
366 getFilter(layer: string): any[];
367
368 setPaintProperty(layer: string, name: string, value: any, options?: FilterOptions): this;
369
370 getPaintProperty(layer: string, name: string): any;
371
372 setLayoutProperty(layer: string, name: string, value: any, options?: FilterOptions): this;
373
374 getLayoutProperty(layer: string, name: string): any;
375
376 /**
377 * Returns the value of a configuration property in the imported style.
378 *
379 * @param {string} importId The name of the imported style to set the config for (e.g. `basemap`).
380 * @param {string} configName The name of the configuration property from the style.
381 * @returns {*} Returns the value of the configuration property.
382 * @example
383 * map.getConfigProperty('basemap', 'showLabels');
384 */
385 getConfigProperty(importId: string, configName: string): any;
386
387 /**
388 * Sets the value of a configuration property in the currently set style.
389 *
390 * @param {string} importId The name of the imported style to set the config for (e.g. `basemap`).
391 * @param {string} configName The name of the configuration property from the style.
392 * @param {*} value The value of the configuration property. Must be of a type appropriate for the property, as defined by the style configuration schema.
393 * @returns {Map} Returns itself to allow for method chaining.
394 * @example
395 * map.setConfigProperty('basemap', 'showLabels', false);
396 */
397 setConfigProperty(importId: string, configName: string, value: any): this;
398
399 setLight(light: mapboxgl.Light, options?: FilterOptions): this;
400
401 getLight(): mapboxgl.Light;
402
403 /**
404 * Sets the terrain property of the style.
405 *
406 * @param terrain Terrain properties to set. Must conform to the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/#terrain).
407 * If `null` or `undefined` is provided, function removes terrain.
408 * @returns {Map} `this`
409 * @example
410 * map.addSource('mapbox-dem', {
411 * 'type': 'raster-dem',
412 * 'url': 'mapbox://mapbox.mapbox-terrain-dem-v1',
413 * 'tileSize': 512,
414 * 'maxzoom': 14
415 * });
416 * // add the DEM source as a terrain layer with exaggerated height
417 * map.setTerrain({ 'source': 'mapbox-dem', 'exaggeration': 1.5 });
418 */
419 setTerrain(terrain?: TerrainSpecification | null): this;
420
421 getTerrain(): TerrainSpecification | null;
422
423 showTerrainWireframe: boolean;
424
425 /**
426 * @param lngLat The coordinate to query
427 * @param options Optional {ElevationQueryOptions}
428 * @returns The elevation in meters at mean sea level or null
429 */
430 queryTerrainElevation(lngLat: mapboxgl.LngLatLike, options?: ElevationQueryOptions): number | null;
431
432 setFeatureState(
433 feature: FeatureIdentifier | mapboxgl.MapboxGeoJSONFeature,
434 state: { [key: string]: any },
435 ): void;
436
437 getFeatureState(feature: FeatureIdentifier | mapboxgl.MapboxGeoJSONFeature): { [key: string]: any };
438
439 removeFeatureState(target: FeatureIdentifier | mapboxgl.MapboxGeoJSONFeature, key?: string): void;
440
441 getContainer(): HTMLElement;
442
443 getCanvasContainer(): HTMLElement;
444
445 getCanvas(): HTMLCanvasElement;
446
447 loaded(): boolean;
448
449 remove(): void;
450
451 triggerRepaint(): void;
452
453 showTileBoundaries: boolean;
454
455 showCollisionBoxes: boolean;
456
457 /**
458 * Gets and sets a Boolean indicating whether the map will visualize
459 * the padding offsets.
460 *
461 * @name showPadding
462 * @instance
463 * @memberof Map
464 */
465 showPadding: boolean;
466
467 repaint: boolean;
468
469 getCenter(): mapboxgl.LngLat;
470
471 setCenter(center: LngLatLike, eventData?: mapboxgl.EventData): this;
472
473 panBy(offset: PointLike, options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this;
474
475 panTo(lnglat: LngLatLike, options?: mapboxgl.AnimationOptions, eventdata?: mapboxgl.EventData): this;
476
477 getZoom(): number;
478
479 setZoom(zoom: number, eventData?: mapboxgl.EventData): this;
480
481 zoomTo(zoom: number, options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this;
482
483 zoomIn(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this;
484
485 zoomOut(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this;
486
487 getBearing(): number;
488
489 setBearing(bearing: number, eventData?: mapboxgl.EventData): this;
490
491 /**
492 * Returns the current padding applied around the map viewport.
493 *
494 * @memberof Map#
495 * @returns The current padding around the map viewport.
496 */
497 getPadding(): PaddingOptions;
498
499 /**
500 * Sets the padding in pixels around the viewport.
501 *
502 * Equivalent to `jumpTo({padding: padding})`.
503 *
504 * @memberof Map#
505 * @param padding The desired padding. Format: { left: number, right: number, top: number, bottom: number }
506 * @param eventData Additional properties to be added to event objects of events triggered by this method.
507 * @fires movestart
508 * @fires moveend
509 * @returns {Map} `this`
510 * @example
511 * // Sets a left padding of 300px, and a top padding of 50px
512 * map.setPadding({ left: 300, top: 50 });
513 */
514 setPadding(padding: PaddingOptions, eventData?: EventData): this;
515
516 rotateTo(bearing: number, options?: AnimationOptions & CameraOptions, eventData?: EventData): this;
517
518 resetNorth(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this;
519
520 resetNorthPitch(options?: mapboxgl.AnimationOptions | null, eventData?: mapboxgl.EventData | null): this;
521
522 snapToNorth(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this;
523
524 getPitch(): number;
525
526 setPitch(pitch: number, eventData?: EventData): this;
527
528 cameraForBounds(bounds: LngLatBoundsLike, options?: CameraForBoundsOptions): CameraForBoundsResult | undefined;
529
530 fitBounds(bounds: LngLatBoundsLike, options?: mapboxgl.FitBoundsOptions, eventData?: mapboxgl.EventData): this;
531
532 fitScreenCoordinates(
533 p0: PointLike,
534 p1: PointLike,
535 bearing: number,
536 options?: AnimationOptions & CameraOptions,
537 eventData?: EventData,
538 ): this;
539
540 jumpTo(options: mapboxgl.CameraOptions, eventData?: mapboxgl.EventData): this;
541
542 /**
543 * Returns position and orientation of the camera entity.
544 *
545 * @memberof Map#
546 * @returns {FreeCameraOptions} The camera state
547 */
548 getFreeCameraOptions(): FreeCameraOptions;
549
550 /**
551 * FreeCameraOptions provides more direct access to the underlying camera entity.
552 * For backwards compatibility the state set using this API must be representable with
553 * `CameraOptions` as well. Parameters are clamped into a valid range or discarded as invalid
554 * if the conversion to the pitch and bearing presentation is ambiguous. For example orientation
555 * can be invalid if it leads to the camera being upside down, the quaternion has zero length,
556 * or the pitch is over the maximum pitch limit.
557 *
558 * @memberof Map#
559 * @param {FreeCameraOptions} options FreeCameraOptions object
560 * @param eventData Additional properties to be added to event objects of events triggered by this method.
561 * @fires movestart
562 * @fires zoomstart
563 * @fires pitchstart
564 * @fires rotate
565 * @fires move
566 * @fires zoom
567 * @fires pitch
568 * @fires moveend
569 * @fires zoomend
570 * @fires pitchend
571 * @returns {Map} `this`
572 */
573 setFreeCameraOptions(options: FreeCameraOptions, eventData?: Object): this;
574
575 easeTo(options: mapboxgl.EaseToOptions, eventData?: mapboxgl.EventData): this;
576
577 flyTo(options: mapboxgl.FlyToOptions, eventData?: mapboxgl.EventData): this;
578
579 isEasing(): boolean;
580
581 stop(): this;
582
583 on<T extends keyof MapLayerEventType>(
584 type: T,
585 layer: string | readonly string[],
586 listener: (ev: MapLayerEventType[T] & EventData) => void,
587 ): this;
588 on<T extends keyof MapEventType>(type: T, listener: (ev: MapEventType[T] & EventData) => void): this;
589 on(type: string, listener: (ev: any) => void): this;
590
591 once<T extends keyof MapLayerEventType>(
592 type: T,
593 layer: string | readonly string[],
594 listener: (ev: MapLayerEventType[T] & EventData) => void,
595 ): this;
596 once<T extends keyof MapEventType>(type: T, listener: (ev: MapEventType[T] & EventData) => void): this;
597 once(type: string, listener: (ev: any) => void): this;
598 once<T extends keyof MapEventType>(type: T): Promise<MapEventType[T]>;
599
600 off<T extends keyof MapLayerEventType>(
601 type: T,
602 layer: string | readonly string[],
603 listener: (ev: MapLayerEventType[T] & EventData) => void,
604 ): this;
605 off<T extends keyof MapEventType>(type: T, listener: (ev: MapEventType[T] & EventData) => void): this;
606 off(type: string, listener: (ev: any) => void): this;
607
608 scrollZoom: ScrollZoomHandler;
609
610 boxZoom: BoxZoomHandler;
611
612 dragRotate: DragRotateHandler;
613
614 dragPan: DragPanHandler;
615
616 keyboard: KeyboardHandler;
617
618 doubleClickZoom: DoubleClickZoomHandler;
619
620 touchZoomRotate: TouchZoomRotateHandler;
621
622 touchPitch: TouchPitchHandler;
623
624 getFog(): Fog | null;
625 /**
626 * @param fog If `null` or `undefined` is provided, function removes fog from
627 * the map.
628 */
629 setFog(fog: Fog | null | undefined): this;
630
631 getProjection(): Projection;
632 setProjection(projection: Projection | string): this;
633 }
634
635 export interface MapboxOptions {
636 /**
637 * If specified, map will use this token instead of the one defined in mapboxgl.accessToken.
638 *
639 * @default null
640 */
641 accessToken?: string | undefined;
642
643 /**
644 * If true, the gl context will be created with MSA antialiasing, which can be useful for antialiasing custom layers.
645 * This is false by default as a performance optimization.
646 */
647 antialias?: boolean | undefined;
648
649 /** If true, an attribution control will be added to the map. */
650 attributionControl?: boolean | undefined;
651
652 bearing?: number | undefined;
653
654 /** Snap to north threshold in degrees. */
655 bearingSnap?: number | undefined;
656
657 /** The initial bounds of the map. If bounds is specified, it overrides center and zoom constructor options. */
658 bounds?: LngLatBoundsLike | undefined;
659
660 /** If true, enable the "box zoom" interaction (see BoxZoomHandler) */
661 boxZoom?: boolean | undefined;
662
663 /** initial map center */
664 center?: LngLatLike | undefined;
665
666 /**
667 * The max number of pixels a user can shift the mouse pointer during a click for it to be
668 * considered a valid click (as opposed to a mouse drag).
669 *
670 * @default 3
671 */
672 clickTolerance?: number | undefined;
673
674 /**
675 * If `true`, Resource Timing API information will be collected for requests made by GeoJSON
676 * and Vector Tile web workers (this information is normally inaccessible from the main
677 * Javascript thread). Information will be returned in a `resourceTiming` property of
678 * relevant `data` events.
679 *
680 * @default false
681 */
682 collectResourceTiming?: boolean | undefined;
683
684 /**
685 * The initial configuration options for the style fragments. Each key in the object is a
686 * fragment ID (e.g., `basemap`) and each value is a configuration object.
687 *
688 * @default null
689 */
690 config?: Record<string, unknown>;
691
692 /**
693 * If `true`, symbols from multiple sources can collide with each other during collision
694 * detection. If `false`, collision detection is run separately for the symbols in each source.
695 *
696 * @default true
697 */
698 crossSourceCollisions?: boolean | undefined;
699
700 /** ID of the container element */
701 container: string | HTMLElement;
702
703 /**
704 * If `true` , scroll zoom will require pressing the ctrl orkey while scrolling to zoom map,
705 * and touch pan will require using two fingers while panning to move the map.
706 * Touch pitch will require three fingers to activate if enabled.
707 */
708 cooperativeGestures?: boolean;
709
710 /** String or strings to show in an AttributionControl.
711 * Only applicable if options.attributionControl is `true`. */
712 customAttribution?: string | string[] | undefined;
713
714 /**
715 * If `true`, the "drag to pan" interaction is enabled.
716 * An `Object` value is passed as options to {@link DragPanHandler#enable}.
717 */
718 dragPan?: boolean | DragPanOptions | undefined;
719
720 /** If true, enable the "drag to rotate" interaction (see DragRotateHandler). */
721 dragRotate?: boolean | undefined;
722
723 /** If true, enable the "double click to zoom" interaction (see DoubleClickZoomHandler). */
724 doubleClickZoom?: boolean | undefined;
725
726 /** 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.
727 * For example, `http://path/to/my/page.html#2.59/39.26/53.07/-24.1/60`.
728 * An additional string may optionally be provided to indicate a parameter-styled hash,
729 * e.g. http://path/to/my/page.html#map=2.59/39.26/53.07/-24.1/60&foo=bar, where foo
730 * is a custom parameter and bar is an arbitrary hash distinct from the map hash.
731 */
732 hash?: boolean | string | undefined;
733
734 /**
735 * Controls the duration of the fade-in/fade-out animation for label collisions, in milliseconds.
736 * This setting affects all symbol layers. This setting does not affect the duration of runtime
737 * styling transitions or raster tile cross-fading.
738 *
739 * @default 300
740 */
741 fadeDuration?: number | undefined;
742
743 /** If true, map creation will fail if the implementation determines that the performance of the created WebGL context would be dramatically lower than expected. */
744 failIfMajorPerformanceCaveat?: boolean | undefined;
745
746 /** A fitBounds options object to use only when setting the bounds option. */
747 fitBoundsOptions?: FitBoundsOptions | undefined;
748
749 /** If false, no mouse, touch, or keyboard listeners are attached to the map, so it will not respond to input */
750 interactive?: boolean | undefined;
751
752 /** If true, enable keyboard shortcuts (see KeyboardHandler). */
753 keyboard?: boolean | undefined;
754
755 /**
756 * A string with a BCP 47 language tag, or an array of such strings representing the desired
757 * languages used for the map's labels and UI components.
758 *
759 * @default null
760 */
761 language?: "auto" | string | string[];
762
763 /** A patch to apply to the default localization table for UI strings, e.g. control tooltips.
764 * The `locale` object maps namespaced UI string IDs to translated strings in the target language;
765 * see `src/ui/default_locale.js` for an example with all supported string IDs.
766 * The object may specify all UI strings (thereby adding support for a new translation) or
767 * only a subset of strings (thereby patching the default translation table).
768 */
769 locale?: { [key: string]: string } | undefined;
770
771 /**
772 * Overrides the generation of all glyphs and font settings except font-weight keywords
773 * Also overrides localIdeographFontFamily
774 * @default null
775 */
776 localFontFamily?: string | undefined;
777
778 /**
779 * If specified, defines a CSS font-family for locally overriding generation of glyphs in the
780 * 'CJK Unified Ideographs' and 'Hangul Syllables' ranges. In these ranges, font settings from
781 * the map's style will be ignored, except for font-weight keywords (light/regular/medium/bold).
782 * The purpose of this option is to avoid bandwidth-intensive glyph server requests.
783 *
784 * @default null
785 */
786 localIdeographFontFamily?: string | undefined;
787
788 /**
789 * A string representing the position of the Mapbox wordmark on the map.
790 *
791 * @default "bottom-left"
792 */
793 logoPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined;
794
795 /** If set, the map is constrained to the given bounds. */
796 maxBounds?: LngLatBoundsLike | undefined;
797
798 /** Maximum pitch of the map. */
799 maxPitch?: number | undefined;
800
801 /**
802 * The maximum number of tiles stored in the tile cache for a given source. If omitted, the
803 * cache will be dynamically sized based on the current viewport.
804 *
805 * @default null
806 */
807 maxTileCacheSize?: number | undefined;
808
809 /** Maximum zoom of the map. */
810 maxZoom?: number | undefined;
811
812 /** Minimum pitch of the map. */
813 minPitch?: number | undefined;
814
815 /**
816 * The minimum number of tiles stored in the tile cache for a given source. If omitted, the
817 * cache will be dynamically sized based on the current viewport.
818 *
819 * @default null
820 */
821 minTileCacheSize?: number | undefined;
822
823 /** Minimum zoom of the map. */
824 minZoom?: number | undefined;
825
826 /**
827 * If `true`, mapbox-gl will collect and send performance metrics.
828 *
829 * @default true
830 */
831 performanceMetricsCollection?: boolean;
832
833 /** If true, The maps canvas can be exported to a PNG using map.getCanvas().toDataURL();. This is false by default as a performance optimization. */
834 preserveDrawingBuffer?: boolean | undefined;
835
836 /**
837 * The initial pitch (tilt) of the map, measured in degrees away from the plane of the
838 * screen (0-60).
839 *
840 * @default 0
841 */
842 pitch?: number | undefined;
843
844 /**
845 * A style's projection property sets which projection a map is rendered in.
846 *
847 * @default 'mercator'
848 */
849 projection?: Projection | Projection["name"];
850
851 /**
852 * If `false`, the map's pitch (tilt) control with "drag to rotate" interaction will be disabled.
853 *
854 * @default true
855 */
856 pitchWithRotate?: boolean | undefined;
857
858 /**
859 * If `false`, the map won't attempt to re-request tiles once they expire per their HTTP
860 * `cacheControl`/`expires` headers.
861 *
862 * @default true
863 */
864 refreshExpiredTiles?: boolean | undefined;
865
866 /**
867 * If `true`, multiple copies of the world will be rendered, when zoomed out.
868 *
869 * @default true
870 */
871 renderWorldCopies?: boolean | undefined;
872
873 /**
874 * If set to `true`, the map will respect the user's `prefers-reduced-motion` browser
875 * setting and apply a reduced motion mode, minimizing animations and transitions. When set
876 * to `false` , the map will always ignore the `prefers-reduced-motion` settings, regardless
877 * of the user's preference, making all animations essential.
878 *
879 * @default true
880 */
881 respectPrefersReducedMotion?: boolean;
882
883 /**
884 * If `true`, the "scroll to zoom" interaction is enabled.
885 * An `Object` value is passed as options to {@link ScrollZoomHandler#enable}.
886 */
887 scrollZoom?: boolean | InteractiveOptions | undefined;
888
889 /** stylesheet location */
890 style?: mapboxgl.Style | string | undefined;
891
892 /**
893 * Allows for the usage of the map in automated tests without an accessToken with custom self-hosted test fixtures.
894 *
895 * @default null
896 */
897 testMode?: boolean | undefined;
898
899 /** If true, the map will automatically resize when the browser window resizes */
900 trackResize?: boolean | undefined;
901
902 /**
903 * A callback run before the Map makes a request for an external URL. The callback can be
904 * used to modify the url, set headers, or set the credentials property for cross-origin requests.
905 *
906 * @default null
907 */
908 transformRequest?: TransformRequestFunction | undefined;
909
910 /**
911 * If `true`, the "pinch to rotate and zoom" interaction is enabled.
912 * An `Object` value is passed as options to {@link TouchZoomRotateHandler#enable}.
913 */
914 touchZoomRotate?: boolean | InteractiveOptions | undefined;
915
916 /**
917 * If `true`, the "drag to pitch" interaction is enabled.
918 * An `Object` value is passed as options to {@link TouchPitchHandler#enable}.
919 */
920 touchPitch?: boolean | InteractiveOptions | undefined;
921
922 /**
923 * Sets the map's worldview. A worldview determines the way that certain disputed boundaries are rendered.
924 * By default, GL JS will not set a worldview so that the worldview of Mapbox tiles will be determined by
925 * the vector tile source's TileJSON. Valid worldview strings must be an ISO alpha-2 country code.
926 *
927 * @default null
928 */
929 worldview?: string | undefined;
930
931 /** Initial zoom level */
932 zoom?: number | undefined;
933 }
934
935 type quat = number[];
936 type vec3 = number[];
937
938 /**
939 * Various options for accessing physical properties of the underlying camera entity.
940 * A direct access to these properties allows more flexible and precise controlling of the camera
941 * while also being fully compatible and interchangeable with CameraOptions. All fields are optional.
942 * See {@Link Camera#setFreeCameraOptions} and {@Link Camera#getFreeCameraOptions}
943 *
944 * @param {MercatorCoordinate} position Position of the camera in slightly modified web mercator coordinates
945 - The size of 1 unit is the width of the projected world instead of the "mercator meter".
946 Coordinate [0, 0, 0] is the north-west corner and [1, 1, 0] is the south-east corner.
947 - Z coordinate is conformal and must respect minimum and maximum zoom values.
948 - Zoom is automatically computed from the altitude (z)
949 * @param {quat} orientation Orientation of the camera represented as a unit quaternion [x, y, z, w]
950 in a left-handed coordinate space. Direction of the rotation is clockwise around the respective axis.
951 The default pose of the camera is such that the forward vector is looking up the -Z axis and
952 the up vector is aligned with north orientation of the map:
953 forward: [0, 0, -1]
954 up: [0, -1, 0]
955 right [1, 0, 0]
956 Orientation can be set freely but certain constraints still apply
957 - Orientation must be representable with only pitch and bearing.
958 - Pitch has an upper limit
959 */
960 export class FreeCameraOptions {
961 constructor(position?: MercatorCoordinate, orientation?: quat);
962
963 position: MercatorCoordinate | undefined;
964
965 /**
966 * Helper function for setting orientation of the camera by defining a focus point
967 * on the map.
968 *
969 * @param {LngLatLike} location Location of the focus point on the map
970 * @param {vec3} up Up vector of the camera is required in certain scenarios where bearing can't be deduced
971 * from the viewing direction.
972 */
973 lookAtPoint(location: LngLatLike, up?: vec3): void;
974
975 /**
976 * Helper function for setting the orientation of the camera as a pitch and a bearing.
977 *
978 * @param {number} pitch Pitch angle in degrees
979 * @param {number} bearing Bearing angle in degrees
980 */
981 setPitchBearing(pitch: number, bearing: number): void;
982 }
983
984 export type ResourceType =
985 | "Unknown"
986 | "Style"
987 | "Source"
988 | "Tile"
989 | "Glyphs"
990 | "SpriteImage"
991 | "SpriteJSON"
992 | "Image";
993
994 export interface RequestParameters {
995 /**
996 * The URL to be requested.
997 */
998 url: string;
999
1000 /**
1001 * Use `'include'` to send cookies with cross-origin requests.
1002 */
1003 credentials?: "same-origin" | "include" | undefined;
1004
1005 /**
1006 * The headers to be sent with the request.
1007 */
1008 headers?: { [header: string]: any } | undefined;
1009
1010 method?: "GET" | "POST" | "PUT" | undefined;
1011
1012 collectResourceTiming?: boolean | undefined;
1013 }
1014
1015 export type TransformRequestFunction = (url: string, resourceType: ResourceType) => RequestParameters;
1016
1017 export interface PaddingOptions {
1018 top: number;
1019 bottom: number;
1020 left: number;
1021 right: number;
1022 }
1023
1024 export interface FeatureIdentifier {
1025 id?: string | number | undefined;
1026 source: string;
1027 sourceLayer?: string | undefined;
1028 }
1029
1030 /**
1031 * BoxZoomHandler
1032 */
1033 export class BoxZoomHandler {
1034 constructor(map: mapboxgl.Map);
1035
1036 isEnabled(): boolean;
1037
1038 isActive(): boolean;
1039
1040 enable(): void;
1041
1042 disable(): void;
1043 }
1044
1045 /**
1046 * ScrollZoomHandler
1047 */
1048 export class ScrollZoomHandler {
1049 constructor(map: mapboxgl.Map);
1050
1051 isEnabled(): boolean;
1052
1053 enable(options?: InteractiveOptions): void;
1054
1055 disable(): void;
1056
1057 setZoomRate(zoomRate: number): void;
1058
1059 setWheelZoomRate(wheelZoomRate: number): void;
1060 }
1061
1062 /**
1063 * DragPenHandler
1064 */
1065 export class DragPanHandler {
1066 constructor(map: mapboxgl.Map);
1067
1068 isEnabled(): boolean;
1069
1070 isActive(): boolean;
1071
1072 enable(options?: DragPanOptions): void;
1073
1074 disable(): void;
1075 }
1076
1077 /**
1078 * DragRotateHandler
1079 */
1080 export class DragRotateHandler {
1081 constructor(
1082 map: mapboxgl.Map,
1083 options?: { bearingSnap?: number | undefined; pitchWithRotate?: boolean | undefined },
1084 );
1085
1086 isEnabled(): boolean;
1087
1088 isActive(): boolean;
1089
1090 enable(): void;
1091
1092 disable(): void;
1093 }
1094
1095 /**
1096 * KeyboardHandler
1097 */
1098 export class KeyboardHandler {
1099 constructor(map: mapboxgl.Map);
1100
1101 isEnabled(): boolean;
1102
1103 enable(): void;
1104
1105 disable(): void;
1106
1107 /**
1108 * Returns true if the handler is enabled and has detected the start of a
1109 * zoom/rotate gesture.
1110 *
1111 * @returns {boolean} `true` if the handler is enabled and has detected the
1112 * start of a zoom/rotate gesture.
1113 */
1114 isActive(): boolean;
1115
1116 /**
1117 * Disables the "keyboard pan/rotate" interaction, leaving the
1118 * "keyboard zoom" interaction enabled.
1119 *
1120 * @example
1121 * map.keyboard.disableRotation();
1122 */
1123 disableRotation(): void;
1124
1125 /**
1126 * Enables the "keyboard pan/rotate" interaction.
1127 *
1128 * @example
1129 * map.keyboard.enable();
1130 * map.keyboard.enableRotation();
1131 */
1132 enableRotation(): void;
1133 }
1134
1135 /**
1136 * DoubleClickZoomHandler
1137 */
1138 export class DoubleClickZoomHandler {
1139 constructor(map: mapboxgl.Map);
1140
1141 isEnabled(): boolean;
1142
1143 enable(): void;
1144
1145 disable(): void;
1146 }
1147
1148 /**
1149 * TouchZoomRotateHandler
1150 */
1151 export class TouchZoomRotateHandler {
1152 constructor(map: mapboxgl.Map);
1153
1154 isEnabled(): boolean;
1155
1156 enable(options?: InteractiveOptions): void;
1157
1158 disable(): void;
1159
1160 disableRotation(): void;
1161
1162 enableRotation(): void;
1163 }
1164
1165 export class TouchPitchHandler {
1166 constructor(map: mapboxgl.Map);
1167
1168 enable(options?: InteractiveOptions): void;
1169
1170 isActive(): boolean;
1171
1172 isEnabled(): boolean;
1173
1174 disable(): void;
1175 }
1176
1177 export interface IControl {
1178 onAdd(map: Map): HTMLElement;
1179
1180 onRemove(map: Map): void;
1181
1182 getDefaultPosition?: (() => string) | undefined;
1183 }
1184
1185 /**
1186 * Control
1187 */
1188 export class Control extends Evented implements IControl {
1189 onAdd(map: Map): HTMLElement;
1190 onRemove(map: Map): void;
1191 getDefaultPosition?: (() => string) | undefined;
1192 }
1193
1194 /**
1195 * Navigation
1196 */
1197 export class NavigationControl extends Control {
1198 constructor(options?: {
1199 showCompass?: boolean | undefined;
1200 showZoom?: boolean | undefined;
1201 visualizePitch?: boolean | undefined;
1202 });
1203 }
1204
1205 export class PositionOptions {
1206 enableHighAccuracy?: boolean | undefined;
1207 timeout?: number | undefined;
1208 maximumAge?: number | undefined;
1209 }
1210
1211 /**
1212 * Geolocate
1213 */
1214 export class GeolocateControl extends Control {
1215 constructor(options?: {
1216 positionOptions?: PositionOptions | undefined;
1217 fitBoundsOptions?: FitBoundsOptions | undefined;
1218 trackUserLocation?: boolean | undefined;
1219 showAccuracyCircle?: boolean | undefined;
1220 showUserLocation?: boolean | undefined;
1221 showUserHeading?: boolean | undefined;
1222 geolocation?: Geolocation | undefined;
1223 });
1224 trigger(): boolean;
1225 }
1226
1227 /**
1228 * Attribution
1229 */
1230 export class AttributionControl extends Control {
1231 constructor(options?: { compact?: boolean | undefined; customAttribution?: string | string[] | undefined });
1232 }
1233
1234 /**
1235 * Scale
1236 */
1237 export class ScaleControl extends Control {
1238 constructor(options?: { maxWidth?: number | undefined; unit?: string | undefined });
1239
1240 setUnit(unit: "imperial" | "metric" | "nautical"): void;
1241 }
1242
1243 /**
1244 * FullscreenControl
1245 */
1246 export class FullscreenControl extends Control {
1247 constructor(options?: FullscreenControlOptions | null);
1248 }
1249
1250 export interface FullscreenControlOptions {
1251 /**
1252 * A compatible DOM element which should be made full screen.
1253 * By default, the map container element will be made full screen.
1254 */
1255 container?: HTMLElement | null | undefined;
1256 }
1257
1258 /**
1259 * Popup
1260 */
1261 export class Popup extends Evented {
1262 constructor(options?: mapboxgl.PopupOptions);
1263
1264 addTo(map: mapboxgl.Map): this;
1265
1266 isOpen(): boolean;
1267
1268 remove(): this;
1269
1270 getLngLat(): mapboxgl.LngLat;
1271
1272 /**
1273 * Sets the geographical location of the popup's anchor, and moves the popup to it. Replaces trackPointer() behavior.
1274 *
1275 * @param lnglat The geographical location to set as the popup's anchor.
1276 */
1277 setLngLat(lnglat: LngLatLike): this;
1278
1279 /**
1280 * Tracks the popup anchor to the cursor position, on screens with a pointer device (will be hidden on touchscreens). Replaces the setLngLat behavior.
1281 * For most use cases, `closeOnClick` and `closeButton` should also be set to `false` here.
1282 */
1283 trackPointer(): this;
1284
1285 /** Returns the `Popup`'s HTML element. */
1286 getElement(): HTMLElement;
1287
1288 setText(text: string): this;
1289
1290 setHTML(html: string): this;
1291
1292 setDOMContent(htmlNode: Node): this;
1293
1294 getMaxWidth(): string;
1295
1296 setMaxWidth(maxWidth: string): this;
1297
1298 /**
1299 * Adds a CSS class to the popup container element.
1300 *
1301 * @param {string} className Non-empty string with CSS class name to add to popup container
1302 *
1303 * @example
1304 * let popup = new mapboxgl.Popup()
1305 * popup.addClassName('some-class')
1306 */
1307 addClassName(className: string): void;
1308
1309 /**
1310 * Removes a CSS class from the popup container element.
1311 *
1312 * @param {string} className Non-empty string with CSS class name to remove from popup container
1313 *
1314 * @example
1315 * let popup = new mapboxgl.Popup()
1316 * popup.removeClassName('some-class')
1317 */
1318 removeClassName(className: string): void;
1319
1320 /**
1321 * Sets the popup's offset.
1322 *
1323 * @param offset Sets the popup's offset.
1324 * @returns {Popup} `this`
1325 */
1326 setOffset(offset?: Offset | null): this;
1327
1328 /**
1329 * Add or remove the given CSS class on the popup container, depending on whether the container currently has that class.
1330 *
1331 * @param {string} className Non-empty string with CSS class name to add/remove
1332 *
1333 * @returns {boolean} if the class was removed return false, if class was added, then return true
1334 *
1335 * @example
1336 * let popup = new mapboxgl.Popup()
1337 * popup.toggleClassName('toggleClass')
1338 */
1339 toggleClassName(className: string): void;
1340 }
1341
1342 export interface PopupOptions {
1343 closeButton?: boolean | undefined;
1344
1345 closeOnClick?: boolean | undefined;
1346
1347 /**
1348 * @param {boolean} [options.closeOnMove=false] If `true`, the popup will closed when the map moves.
1349 */
1350 closeOnMove?: boolean | undefined;
1351
1352 /**
1353 * @param {boolean} [options.focusAfterOpen=true] If `true`, the popup will try to focus the
1354 * first focusable element inside the popup.
1355 */
1356 focusAfterOpen?: boolean | null | undefined;
1357
1358 anchor?: Anchor | undefined;
1359
1360 offset?: Offset | null | undefined;
1361
1362 className?: string | undefined;
1363
1364 maxWidth?: string | undefined;
1365 }
1366
1367 export interface Style {
1368 layers: AnyLayer[];
1369 sources: Sources;
1370
1371 bearing?: number | undefined;
1372 center?: number[] | undefined;
1373 fog?: Fog | undefined;
1374 glyphs?: string | undefined;
1375 metadata?: any;
1376 name?: string | undefined;
1377 pitch?: number | undefined;
1378 light?: Light | undefined;
1379 sprite?: string | undefined;
1380 terrain?: TerrainSpecification | undefined;
1381 transition?: Transition | undefined;
1382 version: number;
1383 zoom?: number | undefined;
1384 }
1385
1386 export interface Transition {
1387 delay?: number | undefined;
1388 duration?: number | undefined;
1389 }
1390
1391 export interface Light {
1392 anchor?: "map" | "viewport" | undefined;
1393 position?: number[] | undefined;
1394 "position-transition"?: Transition | undefined;
1395 color?: string | undefined;
1396 "color-transition"?: Transition | undefined;
1397 intensity?: number | undefined;
1398 "intensity-transition"?: Transition | undefined;
1399 }
1400
1401 export interface Fog {
1402 color?: string | Expression | undefined;
1403 "horizon-blend"?: number | Expression | undefined;
1404 range?: number[] | Expression | undefined;
1405 "high-color"?: string | Expression | undefined;
1406 "space-color"?: string | Expression | undefined;
1407 "star-intensity"?: number | Expression | undefined;
1408 }
1409
1410 export interface Sources {
1411 [sourceName: string]: AnySourceData;
1412 }
1413
1414 export type PromoteIdSpecification = { [key: string]: string } | string;
1415
1416 export type AnySourceData =
1417 | GeoJSONSourceRaw
1418 | VideoSourceRaw
1419 | ImageSourceRaw
1420 | CanvasSourceRaw
1421 | VectorSource
1422 | RasterSource
1423 | RasterDemSource
1424 | CustomSourceInterface<HTMLImageElement | ImageData | ImageBitmap>;
1425
1426 interface RasterSourceImpl extends RasterSource {
1427 /**
1428 * Reloads the source data and re-renders the map.
1429 */
1430 reload(): void;
1431
1432 /**
1433 * Sets the source `tiles` property and re-renders the map.
1434 *
1435 * @param {string[]} tiles An array of one or more tile source URLs, as in the TileJSON spec.
1436 * @returns {RasterTileSource} this
1437 */
1438 setTiles(tiles: readonly string[]): RasterSourceImpl;
1439
1440 /**
1441 * Sets the source `url` property and re-renders the map.
1442 *
1443 * @param {string} url A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`.
1444 * @returns {RasterTileSource} this
1445 */
1446 setUrl(url: string): RasterSourceImpl;
1447 }
1448
1449 interface VectorSourceImpl extends VectorSource {
1450 /**
1451 * Reloads the source data and re-renders the map.
1452 */
1453 reload(): void;
1454
1455 /**
1456 * Sets the source `tiles` property and re-renders the map.
1457 *
1458 * @param {string[]} tiles An array of one or more tile source URLs, as in the TileJSON spec.
1459 * @returns {VectorTileSource} this
1460 */
1461 setTiles(tiles: readonly string[]): VectorSourceImpl;
1462
1463 /**
1464 * Sets the source `url` property and re-renders the map.
1465 *
1466 * @param {string} url A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`.
1467 * @returns {VectorTileSource} this
1468 */
1469 setUrl(url: string): VectorSourceImpl;
1470 }
1471
1472 export type AnySourceImpl =
1473 | GeoJSONSource
1474 | VideoSource
1475 | ImageSource
1476 | CanvasSource
1477 | VectorSourceImpl
1478 | RasterSourceImpl
1479 | RasterDemSource
1480 | CustomSource<HTMLImageElement | ImageData | ImageBitmap>;
1481
1482 export interface Source {
1483 type: "vector" | "raster" | "raster-dem" | "geojson" | "image" | "video" | "canvas" | "custom";
1484 }
1485
1486 /**
1487 * GeoJSONSource
1488 */
1489
1490 export interface GeoJSONSourceRaw extends Source, GeoJSONSourceOptions {
1491 type: "geojson";
1492 }
1493
1494 export class GeoJSONSource implements GeoJSONSourceRaw {
1495 type: "geojson";
1496
1497 constructor(options?: mapboxgl.GeoJSONSourceOptions);
1498
1499 setData(data: GeoJSON.Feature<GeoJSON.Geometry> | GeoJSON.FeatureCollection<GeoJSON.Geometry> | String): this;
1500
1501 getClusterExpansionZoom(clusterId: number, callback: (error: any, zoom: number) => void): this;
1502
1503 getClusterChildren(
1504 clusterId: number,
1505 callback: (error: any, features: Array<GeoJSON.Feature<GeoJSON.Geometry>>) => void,
1506 ): this;
1507
1508 getClusterLeaves(
1509 cluserId: number,
1510 limit: number,
1511 offset: number,
1512 callback: (error: any, features: Array<GeoJSON.Feature<GeoJSON.Geometry>>) => void,
1513 ): this;
1514 }
1515
1516 export interface GeoJSONSourceOptions {
1517 data?:
1518 | GeoJSON.Feature<GeoJSON.Geometry>
1519 | GeoJSON.FeatureCollection<GeoJSON.Geometry>
1520 | GeoJSON.Geometry
1521 | string
1522 | undefined;
1523
1524 maxzoom?: number | undefined;
1525
1526 attribution?: string | undefined;
1527
1528 buffer?: number | undefined;
1529
1530 tolerance?: number | undefined;
1531
1532 cluster?: number | boolean | undefined;
1533
1534 clusterRadius?: number | undefined;
1535
1536 clusterMaxZoom?: number | undefined;
1537
1538 /**
1539 * Minimum number of points necessary to form a cluster if clustering is enabled. Defaults to `2`.
1540 */
1541 clusterMinPoints?: number | undefined;
1542
1543 clusterProperties?: object | undefined;
1544
1545 lineMetrics?: boolean | undefined;
1546
1547 generateId?: boolean | undefined;
1548
1549 promoteId?: PromoteIdSpecification | undefined;
1550
1551 filter?: any;
1552 }
1553
1554 /**
1555 * VideoSource
1556 */
1557 export interface VideoSourceRaw extends Source, VideoSourceOptions {
1558 type: "video";
1559 }
1560
1561 export class VideoSource implements VideoSourceRaw {
1562 type: "video";
1563
1564 constructor(options?: mapboxgl.VideoSourceOptions);
1565
1566 getVideo(): HTMLVideoElement;
1567
1568 setCoordinates(coordinates: number[][]): this;
1569 }
1570
1571 export interface VideoSourceOptions {
1572 urls?: string[] | undefined;
1573
1574 coordinates?: number[][] | undefined;
1575 }
1576
1577 /**
1578 * ImageSource
1579 */
1580 export interface ImageSourceRaw extends Source, ImageSourceOptions {
1581 type: "image";
1582 }
1583
1584 export class ImageSource implements ImageSourceRaw {
1585 type: "image";
1586
1587 constructor(options?: mapboxgl.ImageSourceOptions);
1588
1589 updateImage(options: ImageSourceOptions): this;
1590
1591 setCoordinates(coordinates: number[][]): this;
1592 }
1593
1594 export interface ImageSourceOptions {
1595 url?: string | undefined;
1596
1597 coordinates?: number[][] | undefined;
1598 }
1599
1600 /**
1601 * CanvasSource
1602 */
1603 export interface CanvasSourceRaw extends Source, CanvasSourceOptions {
1604 type: "canvas";
1605 }
1606
1607 export class CanvasSource implements CanvasSourceRaw {
1608 type: "canvas";
1609
1610 coordinates: number[][];
1611
1612 canvas: string | HTMLCanvasElement;
1613
1614 play(): void;
1615
1616 pause(): void;
1617
1618 getCanvas(): HTMLCanvasElement;
1619
1620 setCoordinates(coordinates: number[][]): this;
1621 }
1622
1623 export interface CanvasSourceOptions {
1624 coordinates: number[][];
1625
1626 animate?: boolean | undefined;
1627
1628 canvas: string | HTMLCanvasElement;
1629 }
1630
1631 export type CameraFunctionSpecification<T> =
1632 | { type: "exponential"; stops: Array<[number, T]> }
1633 | { type: "interval"; stops: Array<[number, T]> };
1634
1635 export type ExpressionSpecification = unknown[];
1636
1637 export type PropertyValueSpecification<T> = T | CameraFunctionSpecification<T> | ExpressionSpecification;
1638
1639 export interface TerrainSpecification {
1640 source: string;
1641 exaggeration?: PropertyValueSpecification<number> | undefined;
1642 }
1643
1644 /**
1645 * @see https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#33-vector_layers
1646 */
1647 type SourceVectorLayer = {
1648 id: string;
1649 fields?: Record<string, string>;
1650 description?: string;
1651 minzoom?: number;
1652 maxzoom?: number;
1653
1654 // Non standard extensions that are valid in a Mapbox context.
1655 source?: string;
1656 source_name?: string;
1657 };
1658
1659 interface VectorSource extends Source {
1660 type: "vector";
1661 format?: "pbf";
1662
1663 url?: string | undefined;
1664 id?: string;
1665 name?: string;
1666
1667 tiles?: string[] | undefined;
1668 bounds?: number[] | undefined;
1669 scheme?: "xyz" | "tms" | undefined;
1670 minzoom?: number | undefined;
1671 maxzoom?: number | undefined;
1672 attribution?: string | undefined;
1673 promoteId?: PromoteIdSpecification | undefined;
1674
1675 vector_layers?: SourceVectorLayer[];
1676 }
1677
1678 interface RasterSource extends Source {
1679 name?: string;
1680 type: "raster";
1681 id?: string;
1682 format?: "webp" | string;
1683
1684 url?: string | undefined;
1685 tiles?: string[] | undefined;
1686 bounds?: number[] | undefined;
1687 minzoom?: number | undefined;
1688 maxzoom?: number | undefined;
1689 tileSize?: number | undefined;
1690 scheme?: "xyz" | "tms" | undefined;
1691 attribution?: string | undefined;
1692 }
1693
1694 interface RasterDemSource extends Source {
1695 name?: string;
1696 type: "raster-dem";
1697 id?: string;
1698
1699 url?: string | undefined;
1700 tiles?: string[] | undefined;
1701 bounds?: number[] | undefined;
1702 minzoom?: number | undefined;
1703 maxzoom?: number | undefined;
1704 tileSize?: number | undefined;
1705 attribution?: string | undefined;
1706 encoding?: "terrarium" | "mapbox" | undefined;
1707 }
1708
1709 interface CustomSourceInterface<T> {
1710 id: string;
1711 type: "custom";
1712 dataType: "raster";
1713 minzoom?: number;
1714 maxzoom?: number;
1715 scheme?: string;
1716 tileSize?: number;
1717 attribution?: string;
1718 bounds?: [number, number, number, number];
1719 hasTile?: (tileID: { z: number; x: number; y: number }) => boolean;
1720 loadTile: (tileID: { z: number; x: number; y: number }, options: { signal: AbortSignal }) => Promise<T>;
1721 prepareTile?: (tileID: { z: number; x: number; y: number }) => T | undefined;
1722 unloadTile?: (tileID: { z: number; x: number; y: number }) => void;
1723 onAdd?: (map: Map) => void;
1724 onRemove?: (map: Map) => void;
1725 }
1726
1727 interface CustomSource<T> extends Source {
1728 id: string;
1729 type: "custom";
1730 scheme: string;
1731 minzoom: number;
1732 maxzoom: number;
1733 tileSize: number;
1734 attribution: string;
1735
1736 _implementation: CustomSourceInterface<T>;
1737 }
1738
1739 /**
1740 * LngLat
1741 */
1742 export class LngLat {
1743 lng: number;
1744 lat: number;
1745
1746 constructor(lng: number, lat: number);
1747
1748 /** Return a new LngLat object whose longitude is wrapped to the range (-180, 180). */
1749 wrap(): mapboxgl.LngLat;
1750
1751 /** Return a LngLat as an array */
1752 toArray(): number[];
1753
1754 /** Return a LngLat as a string */
1755 toString(): string;
1756
1757 /** Returns the approximate distance between a pair of coordinates in meters
1758 * Uses the Haversine Formula (from R.W. Sinnott, "Virtues of the Haversine", Sky and Telescope, vol. 68, no. 2, 1984, p. 159) */
1759 distanceTo(lngLat: LngLat): number;
1760
1761 toBounds(radius: number): LngLatBounds;
1762
1763 static convert(input: LngLatLike): mapboxgl.LngLat;
1764 }
1765
1766 /**
1767 * LngLatBounds
1768 */
1769 export class LngLatBounds {
1770 sw: LngLatLike;
1771 ne: LngLatLike;
1772 _sw: LngLat;
1773 _ne: LngLat;
1774
1775 constructor(boundsLike?: [LngLatLike, LngLatLike] | [number, number, number, number]);
1776 constructor(sw: LngLatLike, ne: LngLatLike);
1777
1778 setNorthEast(ne: LngLatLike): this;
1779
1780 setSouthWest(sw: LngLatLike): this;
1781
1782 /** Check if the point is within the bounding box. */
1783 contains(lnglat: LngLatLike): boolean;
1784
1785 /** Extend the bounds to include a given LngLat or LngLatBounds. */
1786 extend(obj: mapboxgl.LngLatLike | mapboxgl.LngLatBoundsLike): this;
1787
1788 /** Get the point equidistant from this box's corners */
1789 getCenter(): mapboxgl.LngLat;
1790
1791 /** Get southwest corner */
1792 getSouthWest(): mapboxgl.LngLat;
1793
1794 /** Get northeast corner */
1795 getNorthEast(): mapboxgl.LngLat;
1796
1797 /** Get northwest corner */
1798 getNorthWest(): mapboxgl.LngLat;
1799
1800 /** Get southeast corner */
1801 getSouthEast(): mapboxgl.LngLat;
1802
1803 /** Get west edge longitude */
1804 getWest(): number;
1805
1806 /** Get south edge latitude */
1807 getSouth(): number;
1808
1809 /** Get east edge longitude */
1810 getEast(): number;
1811
1812 /** Get north edge latitude */
1813 getNorth(): number;
1814
1815 /** Returns a LngLatBounds as an array */
1816 toArray(): number[][];
1817
1818 /** Return a LngLatBounds as a string */
1819 toString(): string;
1820
1821 /** Returns a boolean */
1822 isEmpty(): boolean;
1823
1824 /** Convert an array to a LngLatBounds object, or return an existing LngLatBounds object unchanged. */
1825 static convert(input: LngLatBoundsLike): mapboxgl.LngLatBounds;
1826 }
1827
1828 /**
1829 * Point
1830 */
1831 // Todo: Pull out class to seperate definition for Module "point-geometry"
1832 export class Point {
1833 x: number;
1834 y: number;
1835
1836 constructor(x: number, y: number);
1837
1838 clone(): Point;
1839
1840 add(p: Point): Point;
1841
1842 sub(p: Point): Point;
1843
1844 mult(k: number): Point;
1845
1846 div(k: number): Point;
1847
1848 rotate(a: number): Point;
1849
1850 matMult(m: number): Point;
1851
1852 unit(): Point;
1853
1854 perp(): Point;
1855
1856 round(): Point;
1857
1858 mag(): number;
1859
1860 equals(p: Point): boolean;
1861
1862 dist(p: Point): number;
1863
1864 distSqr(p: Point): number;
1865
1866 angle(): number;
1867
1868 angleTo(p: Point): number;
1869
1870 angleWidth(p: Point): number;
1871
1872 angleWithSep(x: number, y: number): number;
1873
1874 static convert(a: PointLike): Point;
1875 }
1876
1877 /**
1878 * MercatorCoordinate
1879 */
1880 export class MercatorCoordinate {
1881 /** The x component of the position. */
1882 x: number;
1883
1884 /** The y component of the position. */
1885 y: number;
1886
1887 /**
1888 * The z component of the position.
1889 *
1890 * @default 0
1891 */
1892 z?: number | undefined;
1893
1894 constructor(x: number, y: number, z?: number);
1895
1896 /** Returns the altitude in meters of the coordinate. */
1897 toAltitude(): number;
1898
1899 /** Returns the LngLat for the coordinate. */
1900 toLngLat(): LngLat;
1901
1902 /**
1903 * Returns the distance of 1 meter in MercatorCoordinate units at this latitude.
1904 *
1905 * For coordinates in real world units using meters, this naturally provides the
1906 * scale to transform into MercatorCoordinates.
1907 */
1908 meterInMercatorCoordinateUnits(): number;
1909
1910 /** Project a LngLat to a MercatorCoordinate. */
1911 static fromLngLat(lngLatLike: LngLatLike, altitude?: number): MercatorCoordinate;
1912 }
1913
1914 /**
1915 * Marker
1916 */
1917 export class Marker extends Evented {
1918 constructor(options?: mapboxgl.MarkerOptions);
1919
1920 constructor(element?: HTMLElement, options?: mapboxgl.MarkerOptions);
1921
1922 addTo(map: Map): this;
1923
1924 remove(): this;
1925
1926 getLngLat(): LngLat;
1927
1928 setLngLat(lngLat: LngLatLike): this;
1929
1930 getElement(): HTMLElement;
1931
1932 setPopup(popup?: Popup): this;
1933
1934 getPopup(): Popup;
1935
1936 togglePopup(): this;
1937
1938 getOffset(): PointLike;
1939
1940 setOffset(offset: PointLike): this;
1941
1942 setDraggable(shouldBeDraggable: boolean): this;
1943
1944 isDraggable(): boolean;
1945
1946 getRotation(): number;
1947
1948 setRotation(rotation: number): this;
1949
1950 getRotationAlignment(): Alignment;
1951
1952 setRotationAlignment(alignment: Alignment): this;
1953
1954 getPitchAlignment(): Alignment;
1955
1956 setPitchAlignment(alignment: Alignment): this;
1957
1958 getOccludedOpacity(): number;
1959
1960 setOccludedOpacity(opacity: number): this;
1961 }
1962
1963 type Alignment = "map" | "viewport" | "auto";
1964
1965 export interface MarkerOptions {
1966 /** DOM element to use as a marker. The default is a light blue, droplet-shaped SVG marker */
1967 element?: HTMLElement | undefined;
1968
1969 /** The offset in pixels as a PointLike object to apply relative to the element's center. Negatives indicate left and up. */
1970 offset?: PointLike | undefined;
1971
1972 /** A string indicating the part of the Marker that should be positioned closest to the coordinate set via Marker.setLngLat.
1973 * Options are `'center'`, `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-left'`, `'top-right'`, `'bottom-left'`, and `'bottom-right'`.
1974 * The default value os `'center'`
1975 */
1976 anchor?: Anchor | undefined;
1977
1978 /** The color to use for the default marker if options.element is not provided. The default is light blue (#3FB1CE). */
1979 color?: string | undefined;
1980
1981 /** A boolean indicating whether or not a marker is able to be dragged to a new position on the map. The default value is false */
1982 draggable?: boolean | undefined;
1983
1984 /**
1985 * The max number of pixels a user can shift the mouse pointer during a click on the marker for it to be considered a valid click
1986 * (as opposed to a marker drag). The default (0) is to inherit map's clickTolerance.
1987 */
1988 clickTolerance?: number | null | undefined;
1989
1990 /** The rotation angle of the marker in degrees, relative to its `rotationAlignment` setting. A positive value will rotate the marker clockwise.
1991 * The default value is 0.
1992 */
1993 rotation?: number | undefined;
1994
1995 /** `map` aligns the `Marker`'s rotation relative to the map, maintaining a bearing as the map rotates.
1996 * `viewport` aligns the `Marker`'s rotation relative to the viewport, agnostic to map rotations.
1997 * `auto` is equivalent to `viewport`.
1998 * The default value is `auto`
1999 */
2000 rotationAlignment?: Alignment | undefined;
2001
2002 /** `map` aligns the `Marker` to the plane of the map.
2003 * `viewport` aligns the `Marker` to the plane of the viewport.
2004 * `auto` automatically matches the value of `rotationAlignment`.
2005 * The default value is `auto`.
2006 */
2007 pitchAlignment?: Alignment | undefined;
2008
2009 /** The scale to use for the default marker if options.element is not provided.
2010 * The default scale (1) corresponds to a height of `41px` and a width of `27px`.
2011 */
2012 scale?: number | undefined;
2013
2014 /**
2015 * The opacity of a marker that's occluded by 3D terrain. Number between 0 and 1.
2016 */
2017 occludedOpacity?: number | undefined;
2018 }
2019
2020 type EventedListener = (object?: Object) => any;
2021 /**
2022 * Evented
2023 */
2024 export class Evented {
2025 on(type: string, listener: EventedListener): this;
2026
2027 off(type?: string | any, listener?: EventedListener): this;
2028
2029 once(type: string, listener: EventedListener): this;
2030
2031 // https://github.com/mapbox/mapbox-gl-js/issues/6522
2032 fire(type: string, properties?: { [key: string]: any }): this;
2033 }
2034
2035 /**
2036 * StyleOptions
2037 */
2038 export interface StyleOptions {
2039 transition?: boolean | undefined;
2040 }
2041
2042 export type MapboxGeoJSONFeature = GeoJSON.Feature<GeoJSON.Geometry> & {
2043 layer: Layer;
2044 source: string;
2045 sourceLayer: string;
2046 state: { [key: string]: any };
2047 };
2048
2049 export type EventData = { [key: string]: any };
2050
2051 export class MapboxEvent<TOrig = undefined> {
2052 type: string;
2053 target: Map;
2054 originalEvent: TOrig;
2055 }
2056
2057 export class MapMouseEvent extends MapboxEvent<MouseEvent> {
2058 type:
2059 | "mousedown"
2060 | "mouseup"
2061 | "click"
2062 | "dblclick"
2063 | "mousemove"
2064 | "mouseover"
2065 | "mouseenter"
2066 | "mouseleave"
2067 | "mouseout"
2068 | "contextmenu";
2069
2070 point: Point;
2071 lngLat: LngLat;
2072
2073 preventDefault(): void;
2074 defaultPrevented: boolean;
2075 }
2076
2077 export type MapLayerMouseEvent = MapMouseEvent & { features?: MapboxGeoJSONFeature[] | undefined };
2078
2079 export class MapTouchEvent extends MapboxEvent<TouchEvent> {
2080 type: "touchstart" | "touchend" | "touchcancel";
2081
2082 point: Point;
2083 lngLat: LngLat;
2084 points: Point[];
2085 lngLats: LngLat[];
2086
2087 preventDefault(): void;
2088 defaultPrevented: boolean;
2089 }
2090
2091 export type MapLayerTouchEvent = MapTouchEvent & { features?: MapboxGeoJSONFeature[] | undefined };
2092
2093 export class MapWheelEvent extends MapboxEvent<WheelEvent> {
2094 type: "wheel";
2095
2096 preventDefault(): void;
2097 defaultPrevented: boolean;
2098 }
2099
2100 export interface MapBoxZoomEvent extends MapboxEvent<MouseEvent> {
2101 type: "boxzoomstart" | "boxzoomend" | "boxzoomcancel";
2102
2103 boxZoomBounds: LngLatBounds;
2104 }
2105
2106 export type MapDataEvent = MapSourceDataEvent | MapStyleDataEvent;
2107
2108 export interface MapStyleDataEvent extends MapboxEvent {
2109 dataType: "style";
2110 }
2111
2112 export interface MapSourceDataEvent extends MapboxEvent {
2113 dataType: "source";
2114 isSourceLoaded: boolean;
2115 source: Source;
2116 sourceId: string;
2117 sourceDataType: "metadata" | "content";
2118 tile: any;
2119 coord: Coordinate;
2120 }
2121
2122 export interface Coordinate {
2123 canonical: CanonicalCoordinate;
2124 wrap: number;
2125 key: number;
2126 }
2127
2128 export interface CanonicalCoordinate {
2129 x: number;
2130 y: number;
2131 z: number;
2132 key: number;
2133 equals(coord: CanonicalCoordinate): boolean;
2134 }
2135
2136 export interface MapContextEvent extends MapboxEvent<WebGLContextEvent> {
2137 type: "webglcontextlost" | "webglcontextrestored";
2138 }
2139
2140 export class ErrorEvent extends MapboxEvent {
2141 type: "error";
2142 error: Error;
2143 }
2144
2145 /**
2146 * FilterOptions
2147 */
2148 export interface FilterOptions {
2149 /**
2150 * Whether to check if the filter conforms to the Mapbox GL Style Specification.
2151 * Disabling validation is a performance optimization that should only be used
2152 * if you have previously validated the values you will be passing to this function.
2153 */
2154 validate?: boolean | null | undefined;
2155 }
2156
2157 /**
2158 * AnimationOptions
2159 */
2160 export interface AnimationOptions {
2161 /** Number in milliseconds */
2162 duration?: number | undefined;
2163 /**
2164 * A function taking a time in the range 0..1 and returning a number where 0 is the initial
2165 * state and 1 is the final state.
2166 */
2167 easing?: ((time: number) => number) | undefined;
2168 /** point, origin of movement relative to map center */
2169 offset?: PointLike | undefined;
2170 /** When set to false, no animation happens */
2171 animate?: boolean | undefined;
2172
2173 /** If `true`, then the animation is considered essential and will not be affected by `prefers-reduced-motion`.
2174 * Otherwise, the transition will happen instantly if the user has enabled the `reduced motion` accesibility feature in their operating system.
2175 */
2176 essential?: boolean | undefined;
2177 }
2178
2179 /**
2180 * CameraOptions
2181 */
2182 export interface CameraOptions {
2183 /** Map center */
2184 center?: LngLatLike | undefined;
2185 /** Map zoom level */
2186 zoom?: number | undefined;
2187 /** Map rotation bearing in degrees counter-clockwise from north */
2188 bearing?: number | undefined;
2189 /** Map angle in degrees at which the camera is looking at the ground */
2190 pitch?: number | undefined;
2191 /** If zooming, the zoom center (defaults to map center) */
2192 around?: LngLatLike | undefined;
2193 /** Dimensions in pixels applied on each side of the viewport for shifting the vanishing point. */
2194 padding?: number | PaddingOptions | undefined;
2195 }
2196
2197 export interface CameraForBoundsOptions extends CameraOptions {
2198 offset?: PointLike | undefined;
2199 maxZoom?: number | undefined;
2200 }
2201
2202 // The Mapbox docs say that if the result is defined, it will have zoom, center and bearing set.
2203 // In practice center is always a {lat, lng} object.
2204 export type CameraForBoundsResult = Required<Pick<CameraOptions, "zoom" | "bearing">> & {
2205 /** Map center */
2206 center: { lng: number; lat: number };
2207 };
2208
2209 /**
2210 * FlyToOptions
2211 */
2212 export interface FlyToOptions extends AnimationOptions, CameraOptions {
2213 curve?: number | undefined;
2214 minZoom?: number | undefined;
2215 speed?: number | undefined;
2216 screenSpeed?: number | undefined;
2217 maxDuration?: number | undefined;
2218 }
2219
2220 /**
2221 * EaseToOptions
2222 */
2223 export interface EaseToOptions extends AnimationOptions, CameraOptions {
2224 delayEndEvents?: number | undefined;
2225 }
2226
2227 export interface FitBoundsOptions extends mapboxgl.FlyToOptions {
2228 linear?: boolean | undefined;
2229 offset?: mapboxgl.PointLike | undefined;
2230 maxZoom?: number | undefined;
2231 maxDuration?: number | undefined;
2232 }
2233
2234 /**
2235 * MapEvent
2236 */
2237 export type MapEventType = {
2238 error: ErrorEvent;
2239
2240 load: MapboxEvent;
2241 idle: MapboxEvent;
2242 remove: MapboxEvent;
2243 render: MapboxEvent;
2244 resize: MapboxEvent;
2245
2246 webglcontextlost: MapContextEvent;
2247 webglcontextrestored: MapContextEvent;
2248
2249 dataloading: MapDataEvent;
2250 data: MapDataEvent;
2251 tiledataloading: MapDataEvent;
2252 sourcedataloading: MapSourceDataEvent;
2253 styledataloading: MapStyleDataEvent;
2254 sourcedata: MapSourceDataEvent;
2255 styledata: MapStyleDataEvent;
2256 "style.load": MapboxEvent;
2257 "style.import.load": MapboxEvent;
2258
2259 boxzoomcancel: MapBoxZoomEvent;
2260 boxzoomstart: MapBoxZoomEvent;
2261 boxzoomend: MapBoxZoomEvent;
2262
2263 touchcancel: MapTouchEvent;
2264 touchmove: MapTouchEvent;
2265 touchend: MapTouchEvent;
2266 touchstart: MapTouchEvent;
2267
2268 click: MapMouseEvent;
2269 contextmenu: MapMouseEvent;
2270 dblclick: MapMouseEvent;
2271 mousemove: MapMouseEvent;
2272 mouseup: MapMouseEvent;
2273 mousedown: MapMouseEvent;
2274 mouseout: MapMouseEvent;
2275 mouseover: MapMouseEvent;
2276
2277 movestart: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
2278 move: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
2279 moveend: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
2280
2281 zoomstart: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
2282 zoom: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
2283 zoomend: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
2284
2285 rotatestart: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2286 rotate: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2287 rotateend: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2288
2289 dragstart: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2290 drag: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2291 dragend: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2292
2293 pitchstart: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2294 pitch: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2295 pitchend: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2296
2297 wheel: MapWheelEvent;
2298 };
2299
2300 export type MapLayerEventType = {
2301 click: MapLayerMouseEvent;
2302 dblclick: MapLayerMouseEvent;
2303 mousedown: MapLayerMouseEvent;
2304 mouseup: MapLayerMouseEvent;
2305 mousemove: MapLayerMouseEvent;
2306 mouseenter: MapLayerMouseEvent;
2307 mouseleave: MapLayerMouseEvent;
2308 mouseover: MapLayerMouseEvent;
2309 mouseout: MapLayerMouseEvent;
2310 contextmenu: MapLayerMouseEvent;
2311
2312 touchstart: MapLayerTouchEvent;
2313 touchend: MapLayerTouchEvent;
2314 touchcancel: MapLayerTouchEvent;
2315 };
2316
2317 export type AnyLayout =
2318 | BackgroundLayout
2319 | FillLayout
2320 | FillExtrusionLayout
2321 | LineLayout
2322 | SymbolLayout
2323 | RasterLayout
2324 | CircleLayout
2325 | HeatmapLayout
2326 | HillshadeLayout
2327 | SkyLayout;
2328
2329 export type AnyPaint =
2330 | BackgroundPaint
2331 | FillPaint
2332 | FillExtrusionPaint
2333 | LinePaint
2334 | SymbolPaint
2335 | RasterPaint
2336 | CirclePaint
2337 | HeatmapPaint
2338 | HillshadePaint
2339 | SkyPaint;
2340
2341 interface Layer {
2342 id: string;
2343 type: string;
2344
2345 metadata?: any;
2346 ref?: string | undefined;
2347
2348 source?: string | AnySourceData | undefined;
2349
2350 "source-layer"?: string | undefined;
2351
2352 minzoom?: number | undefined;
2353 maxzoom?: number | undefined;
2354
2355 interactive?: boolean | undefined;
2356
2357 filter?: any[] | undefined;
2358 layout?: AnyLayout | undefined;
2359 paint?: AnyPaint | undefined;
2360 }
2361
2362 interface BackgroundLayer extends Layer {
2363 type: "background";
2364 layout?: BackgroundLayout | undefined;
2365 paint?: BackgroundPaint | undefined;
2366 }
2367
2368 interface CircleLayer extends Layer {
2369 type: "circle";
2370 layout?: CircleLayout | undefined;
2371 paint?: CirclePaint | undefined;
2372 }
2373
2374 interface FillExtrusionLayer extends Layer {
2375 type: "fill-extrusion";
2376 layout?: FillExtrusionLayout | undefined;
2377 paint?: FillExtrusionPaint | undefined;
2378 }
2379
2380 interface FillLayer extends Layer {
2381 type: "fill";
2382 layout?: FillLayout | undefined;
2383 paint?: FillPaint | undefined;
2384 }
2385
2386 interface HeatmapLayer extends Layer {
2387 type: "heatmap";
2388 layout?: HeatmapLayout | undefined;
2389 paint?: HeatmapPaint | undefined;
2390 }
2391
2392 interface HillshadeLayer extends Layer {
2393 type: "hillshade";
2394 layout?: HillshadeLayout | undefined;
2395 paint?: HillshadePaint | undefined;
2396 }
2397
2398 interface LineLayer extends Layer {
2399 type: "line";
2400 layout?: LineLayout | undefined;
2401 paint?: LinePaint | undefined;
2402 }
2403
2404 interface RasterLayer extends Layer {
2405 type: "raster";
2406 layout?: RasterLayout | undefined;
2407 paint?: RasterPaint | undefined;
2408 }
2409
2410 interface SymbolLayer extends Layer {
2411 type: "symbol";
2412 layout?: SymbolLayout | undefined;
2413 paint?: SymbolPaint | undefined;
2414 }
2415
2416 interface SkyLayer extends Layer {
2417 type: "sky";
2418 layout?: SkyLayout | undefined;
2419 paint?: SkyPaint | undefined;
2420 }
2421
2422 export type AnyLayer =
2423 | BackgroundLayer
2424 | CircleLayer
2425 | FillExtrusionLayer
2426 | FillLayer
2427 | HeatmapLayer
2428 | HillshadeLayer
2429 | LineLayer
2430 | RasterLayer
2431 | SymbolLayer
2432 | CustomLayerInterface
2433 | SkyLayer;
2434
2435 // See https://docs.mapbox.com/mapbox-gl-js/api/#customlayerinterface
2436 export interface CustomLayerInterface {
2437 /** A unique layer id. */
2438 id: string;
2439
2440 /* The layer's type. Must be "custom". */
2441 type: "custom";
2442
2443 /* Either "2d" or "3d". Defaults to "2d". */
2444 renderingMode?: "2d" | "3d" | undefined;
2445
2446 /**
2447 * Optional method called when the layer has been removed from the Map with Map#removeLayer.
2448 * This gives the layer a chance to clean up gl resources and event listeners.
2449 * @param map The Map this custom layer was just added to.
2450 * @param gl The gl context for the map.
2451 */
2452 onRemove?(map: mapboxgl.Map, gl: WebGLRenderingContext): void;
2453
2454 /**
2455 * Optional method called when the layer has been added to the Map with Map#addLayer.
2456 * This gives the layer a chance to initialize gl resources and register event listeners.
2457 * @param map The Map this custom layer was just added to.
2458 * @param gl The gl context for the map.
2459 */
2460 onAdd?(map: mapboxgl.Map, gl: WebGLRenderingContext): void;
2461
2462 /**
2463 * Optional method called during a render frame to allow a layer to prepare resources
2464 * or render into a texture.
2465 *
2466 * The layer cannot make any assumptions about the current GL state and must bind a framebuffer
2467 * before rendering.
2468 * @param gl The map's gl context.
2469 * @param matrix The map's camera matrix. It projects spherical mercator coordinates to gl
2470 * coordinates. The mercator coordinate [0, 0] represents the top left corner of
2471 * the mercator world and [1, 1] represents the bottom right corner. When the
2472 * renderingMode is "3d" , the z coordinate is conformal. A box with identical
2473 * x, y, and z lengths in mercator units would be rendered as a cube.
2474 * MercatorCoordinate .fromLatLng can be used to project a LngLat to a mercator
2475 * coordinate.
2476 */
2477 prerender?(gl: WebGLRenderingContext, matrix: number[]): void;
2478
2479 /**
2480 * Called during a render frame allowing the layer to draw into the GL context.
2481 *
2482 * The layer can assume blending and depth state is set to allow the layer to properly blend
2483 * and clip other layers. The layer cannot make any other assumptions about the current GL state.
2484 *
2485 * If the layer needs to render to a texture, it should implement the prerender method to do this
2486 * and only use the render method for drawing directly into the main framebuffer.
2487 *
2488 * The blend function is set to gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA). This expects
2489 * colors to be provided in premultiplied alpha form where the r, g and b values are already
2490 * multiplied by the a value. If you are unable to provide colors in premultiplied form you may
2491 * want to change the blend function to
2492 * gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA).
2493 *
2494 * @param gl The map's gl context.
2495 * @param matrix The map's camera matrix. It projects spherical mercator coordinates to gl
2496 * coordinates. The mercator coordinate [0, 0] represents the top left corner of
2497 * the mercator world and [1, 1] represents the bottom right corner. When the
2498 * renderingMode is "3d" , the z coordinate is conformal. A box with identical
2499 * x, y, and z lengths in mercator units would be rendered as a cube.
2500 * MercatorCoordinate .fromLatLng can be used to project a LngLat to a mercator
2501 * coordinate.
2502 */
2503 render(gl: WebGLRenderingContext, matrix: number[]): void;
2504 }
2505
2506 export interface StyleFunction {
2507 stops?: any[][] | undefined;
2508 property?: string | undefined;
2509 base?: number | undefined;
2510 type?: "identity" | "exponential" | "interval" | "categorical" | undefined;
2511 default?: any;
2512 colorSpace?: "rgb" | "lab" | "hcl" | undefined;
2513 }
2514
2515 type Visibility = "visible" | "none";
2516
2517 export interface Layout {
2518 visibility?: Visibility | undefined;
2519 }
2520
2521 export interface BackgroundLayout extends Layout {}
2522
2523 export interface BackgroundPaint {
2524 "background-color"?: string | Expression | undefined;
2525 "background-color-transition"?: Transition | undefined;
2526 "background-pattern"?: string | undefined;
2527 "background-pattern-transition"?: Transition | undefined;
2528 "background-opacity"?: number | Expression | undefined;
2529 "background-opacity-transition"?: Transition | undefined;
2530 "background-emissive-strength"?: number | Expression | undefined;
2531 }
2532
2533 export interface FillLayout extends Layout {
2534 "fill-sort-key"?: number | Expression | undefined;
2535 }
2536
2537 export interface FillPaint {
2538 "fill-antialias"?: boolean | Expression | undefined;
2539 "fill-opacity"?: number | StyleFunction | Expression | undefined;
2540 "fill-opacity-transition"?: Transition | undefined;
2541 "fill-color"?: string | StyleFunction | Expression | undefined;
2542 "fill-color-transition"?: Transition | undefined;
2543 "fill-outline-color"?: string | StyleFunction | Expression | undefined;
2544 "fill-outline-color-transition"?: Transition | undefined;
2545 "fill-translate"?: number[] | undefined;
2546 "fill-translate-transition"?: Transition | undefined;
2547 "fill-translate-anchor"?: "map" | "viewport" | undefined;
2548 "fill-pattern"?: string | Expression | undefined;
2549 "fill-pattern-transition"?: Transition | undefined;
2550 "fill-emissive-strength"?: number | Expression | undefined;
2551 "fill-extrusion-ambient-occlusion-ground-attenuation"?: number | Expression | undefined;
2552 "fill-extrusion-ambient-occlusion-ground-radius"?: number | Expression | undefined;
2553 "fill-extrusion-ambient-occlusion-wall-radius"?: number | Expression | undefined;
2554 "fill-extrusion-flood-light-color"?: string | StyleFunction | Expression | undefined;
2555 "fill-extrusion-flood-light-ground-attenuation"?: number | Expression | undefined;
2556 "fill-extrusion-flood-light-ground-radius"?: number | Expression | undefined;
2557 "fill-extrusion-flood-light-intensity"?: number | Expression | undefined;
2558 "fill-extrusion-flood-light-wall-radius"?: number | Expression | undefined;
2559 "fill-extrusion-vertical-scale"?: number | Expression | undefined;
2560 }
2561
2562 export interface FillExtrusionLayout extends Layout {}
2563
2564 export interface FillExtrusionPaint {
2565 "fill-extrusion-opacity"?: number | Expression | undefined;
2566 "fill-extrusion-opacity-transition"?: Transition | undefined;
2567 "fill-extrusion-color"?: string | StyleFunction | Expression | undefined;
2568 "fill-extrusion-color-transition"?: Transition | undefined;
2569 "fill-extrusion-translate"?: number[] | Expression | undefined;
2570 "fill-extrusion-translate-transition"?: Transition | undefined;
2571 "fill-extrusion-translate-anchor"?: "map" | "viewport" | undefined;
2572 "fill-extrusion-pattern"?: string | Expression | undefined;
2573 "fill-extrusion-pattern-transition"?: Transition | undefined;
2574 "fill-extrusion-height"?: number | StyleFunction | Expression | undefined;
2575 "fill-extrusion-height-transition"?: Transition | undefined;
2576 "fill-extrusion-base"?: number | StyleFunction | Expression | undefined;
2577 "fill-extrusion-base-transition"?: Transition | undefined;
2578 "fill-extrusion-vertical-gradient"?: boolean | undefined;
2579 }
2580
2581 export interface LineLayout extends Layout {
2582 "line-cap"?: "butt" | "round" | "square" | Expression | undefined;
2583 "line-join"?: "bevel" | "round" | "miter" | Expression | undefined;
2584 "line-miter-limit"?: number | Expression | undefined;
2585 "line-round-limit"?: number | Expression | undefined;
2586 "line-sort-key"?: number | Expression | undefined;
2587 }
2588
2589 export interface LinePaint {
2590 "line-opacity"?: number | StyleFunction | Expression | undefined;
2591 "line-opacity-transition"?: Transition | undefined;
2592 "line-color"?: string | StyleFunction | Expression | undefined;
2593 "line-color-transition"?: Transition | undefined;
2594 "line-translate"?: number[] | Expression | undefined;
2595 "line-translate-transition"?: Transition | undefined;
2596 "line-translate-anchor"?: "map" | "viewport" | undefined;
2597 "line-width"?: number | StyleFunction | Expression | undefined;
2598 "line-width-transition"?: Transition | undefined;
2599 "line-gap-width"?: number | StyleFunction | Expression | undefined;
2600 "line-gap-width-transition"?: Transition | undefined;
2601 "line-offset"?: number | StyleFunction | Expression | undefined;
2602 "line-offset-transition"?: Transition | undefined;
2603 "line-blur"?: number | StyleFunction | Expression | undefined;
2604 "line-blur-transition"?: Transition | undefined;
2605 "line-dasharray"?: number[] | Expression | undefined;
2606 "line-dasharray-transition"?: Transition | undefined;
2607 "line-pattern"?: string | Expression | undefined;
2608 "line-pattern-transition"?: Transition | undefined;
2609 "line-gradient"?: Expression | undefined;
2610 "line-emissive-strength"?: number | Expression | undefined;
2611 }
2612
2613 export interface SymbolLayout extends Layout {
2614 "symbol-placement"?: "point" | "line" | "line-center" | undefined;
2615 "symbol-spacing"?: number | Expression | undefined;
2616 "symbol-avoid-edges"?: boolean | undefined;
2617 "symbol-z-order"?: "viewport-y" | "source" | undefined;
2618 "icon-allow-overlap"?: boolean | StyleFunction | Expression | undefined;
2619 "icon-ignore-placement"?: boolean | Expression | undefined;
2620 "icon-optional"?: boolean | undefined;
2621 "icon-rotation-alignment"?: "map" | "viewport" | "auto" | undefined;
2622 "icon-size"?: number | StyleFunction | Expression | undefined;
2623 "icon-text-fit"?: "none" | "both" | "width" | "height" | undefined;
2624 "icon-text-fit-padding"?: number[] | Expression | undefined;
2625 "icon-image"?: string | StyleFunction | Expression | undefined;
2626 "icon-rotate"?: number | StyleFunction | Expression | undefined;
2627 "icon-padding"?: number | Expression | undefined;
2628 "icon-keep-upright"?: boolean | undefined;
2629 "icon-offset"?: number[] | StyleFunction | Expression | undefined;
2630 "icon-anchor"?: Anchor | StyleFunction | Expression | undefined;
2631 "icon-pitch-alignment"?: "map" | "viewport" | "auto" | undefined;
2632 "text-pitch-alignment"?: "map" | "viewport" | "auto" | undefined;
2633 "text-rotation-alignment"?: "map" | "viewport" | "auto" | undefined;
2634 "text-field"?: string | StyleFunction | Expression | undefined;
2635 "text-font"?: string[] | Expression | undefined;
2636 "text-size"?: number | StyleFunction | Expression | undefined;
2637 "text-max-width"?: number | StyleFunction | Expression | undefined;
2638 "text-line-height"?: number | Expression | undefined;
2639 "text-letter-spacing"?: number | Expression | undefined;
2640 "text-justify"?: "auto" | "left" | "center" | "right" | Expression | undefined;
2641 "text-anchor"?: Anchor | StyleFunction | Expression | undefined;
2642 "text-max-angle"?: number | Expression | undefined;
2643 "text-rotate"?: number | StyleFunction | Expression | undefined;
2644 "text-padding"?: number | Expression | undefined;
2645 "text-keep-upright"?: boolean | undefined;
2646 "text-transform"?: "none" | "uppercase" | "lowercase" | StyleFunction | Expression | undefined;
2647 "text-offset"?: number[] | Expression | undefined;
2648 "text-allow-overlap"?: boolean | undefined;
2649 "text-ignore-placement"?: boolean | undefined;
2650 "text-optional"?: boolean | undefined;
2651 "text-radial-offset"?: number | Expression | undefined;
2652 "text-variable-anchor"?: Anchor[] | undefined;
2653 "text-writing-mode"?: Array<"horizontal" | "vertical"> | undefined;
2654 "symbol-sort-key"?: number | Expression | undefined;
2655 }
2656
2657 export interface SymbolPaint {
2658 "icon-opacity"?: number | StyleFunction | Expression | undefined;
2659 "icon-opacity-transition"?: Transition | undefined;
2660 "icon-color"?: string | StyleFunction | Expression | undefined;
2661 "icon-color-transition"?: Transition | undefined;
2662 "icon-halo-color"?: string | StyleFunction | Expression | undefined;
2663 "icon-halo-color-transition"?: Transition | undefined;
2664 "icon-halo-width"?: number | StyleFunction | Expression | undefined;
2665 "icon-halo-width-transition"?: Transition | undefined;
2666 "icon-halo-blur"?: number | StyleFunction | Expression | undefined;
2667 "icon-halo-blur-transition"?: Transition | undefined;
2668 "icon-translate"?: number[] | Expression | undefined;
2669 "icon-translate-transition"?: Transition | undefined;
2670 "icon-translate-anchor"?: "map" | "viewport" | undefined;
2671 "icon-emissive-strength"?: number | StyleFunction | Expression | undefined;
2672 "icon-image-cross-fade"?: number | StyleFunction | Expression | undefined;
2673 "text-opacity"?: number | StyleFunction | Expression | undefined;
2674 "text-opacity-transition"?: Transition | undefined;
2675 "text-color"?: string | StyleFunction | Expression | undefined;
2676 "text-color-transition"?: Transition | undefined;
2677 "text-halo-color"?: string | StyleFunction | Expression | undefined;
2678 "text-halo-color-transition"?: Transition | undefined;
2679 "text-halo-width"?: number | StyleFunction | Expression | undefined;
2680 "text-halo-width-transition"?: Transition | undefined;
2681 "text-halo-blur"?: number | StyleFunction | Expression | undefined;
2682 "text-halo-blur-transition"?: Transition | undefined;
2683 "text-translate"?: number[] | Expression | undefined;
2684 "text-translate-transition"?: Transition | undefined;
2685 "text-translate-anchor"?: "map" | "viewport" | undefined;
2686 "text-emissive-strength"?: number | StyleFunction | Expression | undefined;
2687 }
2688
2689 export interface RasterLayout extends Layout {}
2690
2691 export interface RasterPaint {
2692 "raster-opacity"?: number | Expression | undefined;
2693 "raster-opacity-transition"?: Transition | undefined;
2694 "raster-hue-rotate"?: number | Expression | undefined;
2695 "raster-hue-rotate-transition"?: Transition | undefined;
2696 "raster-brightness-min"?: number | Expression | undefined;
2697 "raster-brightness-min-transition"?: Transition | undefined;
2698 "raster-brightness-max"?: number | Expression | undefined;
2699 "raster-brightness-max-transition"?: Transition | undefined;
2700 "raster-saturation"?: number | Expression | undefined;
2701 "raster-saturation-transition"?: Transition | undefined;
2702 "raster-contrast"?: number | Expression | undefined;
2703 "raster-contrast-transition"?: Transition | undefined;
2704 "raster-fade-duration"?: number | Expression | undefined;
2705 "raster-resampling"?: "linear" | "nearest" | undefined;
2706 "raster-color"?: string | Expression | undefined;
2707 "raster-color-mix"?: [number, number, number, number] | Expression | undefined;
2708 "raster-color-range"?: [number, number] | Expression | undefined;
2709 }
2710
2711 export interface CircleLayout extends Layout {
2712 "circle-sort-key"?: number | Expression | undefined;
2713 }
2714
2715 export interface CirclePaint {
2716 "circle-radius"?: number | StyleFunction | Expression | undefined;
2717 "circle-radius-transition"?: Transition | undefined;
2718 "circle-color"?: string | StyleFunction | Expression | undefined;
2719 "circle-color-transition"?: Transition | undefined;
2720 "circle-blur"?: number | StyleFunction | Expression | undefined;
2721 "circle-blur-transition"?: Transition | undefined;
2722 "circle-opacity"?: number | StyleFunction | Expression | undefined;
2723 "circle-opacity-transition"?: Transition | undefined;
2724 "circle-translate"?: number[] | Expression | undefined;
2725 "circle-translate-transition"?: Transition | undefined;
2726 "circle-translate-anchor"?: "map" | "viewport" | undefined;
2727 "circle-pitch-scale"?: "map" | "viewport" | undefined;
2728 "circle-pitch-alignment"?: "map" | "viewport" | undefined;
2729 "circle-stroke-width"?: number | StyleFunction | Expression | undefined;
2730 "circle-stroke-width-transition"?: Transition | undefined;
2731 "circle-stroke-color"?: string | StyleFunction | Expression | undefined;
2732 "circle-stroke-color-transition"?: Transition | undefined;
2733 "circle-stroke-opacity"?: number | StyleFunction | Expression | undefined;
2734 "circle-stroke-opacity-transition"?: Transition | undefined;
2735 "circle-emissive-strength"?: number | StyleFunction | Expression | undefined;
2736 }
2737
2738 export interface HeatmapLayout extends Layout {}
2739
2740 export interface HeatmapPaint {
2741 "heatmap-radius"?: number | StyleFunction | Expression | undefined;
2742 "heatmap-radius-transition"?: Transition | undefined;
2743 "heatmap-weight"?: number | StyleFunction | Expression | undefined;
2744 "heatmap-intensity"?: number | StyleFunction | Expression | undefined;
2745 "heatmap-intensity-transition"?: Transition | undefined;
2746 "heatmap-color"?: string | StyleFunction | Expression | undefined;
2747 "heatmap-opacity"?: number | StyleFunction | Expression | undefined;
2748 "heatmap-opacity-transition"?: Transition | undefined;
2749 }
2750
2751 export interface HillshadeLayout extends Layout {}
2752
2753 export interface HillshadePaint {
2754 "hillshade-illumination-direction"?: number | Expression | undefined;
2755 "hillshade-illumination-anchor"?: "map" | "viewport" | undefined;
2756 "hillshade-exaggeration"?: number | Expression | undefined;
2757 "hillshade-exaggeration-transition"?: Transition | undefined;
2758 "hillshade-shadow-color"?: string | Expression | undefined;
2759 "hillshade-shadow-color-transition"?: Transition | undefined;
2760 "hillshade-highlight-color"?: string | Expression | undefined;
2761 "hillshade-highlight-color-transition"?: Transition | undefined;
2762 "hillshade-accent-color"?: string | Expression | undefined;
2763 "hillshade-accent-color-transition"?: Transition | undefined;
2764 }
2765
2766 export interface SkyLayout extends Layout {}
2767
2768 export interface SkyPaint {
2769 "sky-atmosphere-color"?: string | Expression | undefined;
2770 "sky-atmosphere-halo-color"?: string | Expression | undefined;
2771 "sky-atmosphere-sun"?: number[] | Expression | undefined;
2772 "sky-atmosphere-sun-intensity"?: number | Expression | undefined;
2773 "sky-gradient"?: string | Expression | undefined;
2774 "sky-gradient-center"?: number[] | Expression | undefined;
2775 "sky-gradient-radius"?: number | Expression | undefined;
2776 "sky-opacity"?: number | Expression | undefined;
2777 "sky-type"?: "gradient" | "atmosphere" | undefined;
2778 }
2779
2780 export type ElevationQueryOptions = {
2781 exaggerated: boolean;
2782 };
2783
2784 export interface Projection {
2785 name:
2786 | "albers"
2787 | "equalEarth"
2788 | "equirectangular"
2789 | "lambertConformalConic"
2790 | "mercator"
2791 | "naturalEarth"
2792 | "winkelTripel"
2793 | "globe";
2794 center?: [number, number];
2795 parallels?: [number, number];
2796 }
2797}
2798
\No newline at end of file