UNPKG

99.3 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 /** @see https://docs.mapbox.com/mapbox-gl-js/api/markers/#marker-parameters */
1966 export interface MarkerOptions {
1967 /** DOM element to use as a marker. The default is a light blue, droplet-shaped SVG marker */
1968 element?: HTMLElement | undefined;
1969
1970 /** The offset in pixels as a PointLike object to apply relative to the element's center. Negatives indicate left and up. */
1971 offset?: PointLike | undefined;
1972
1973 /** A string indicating the part of the Marker that should be positioned closest to the coordinate set via Marker.setLngLat.
1974 * Options are `'center'`, `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-left'`, `'top-right'`, `'bottom-left'`, and `'bottom-right'`.
1975 * The default value os `'center'`
1976 */
1977 anchor?: Anchor | undefined;
1978
1979 /** The color to use for the default marker if options.element is not provided. The default is light blue (#3FB1CE). */
1980 color?: string | undefined;
1981
1982 /** Space-separated CSS class names to add to marker element. */
1983 className?: string | undefined;
1984
1985 /** 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 */
1986 draggable?: boolean | undefined;
1987
1988 /**
1989 * 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
1990 * (as opposed to a marker drag). The default (0) is to inherit map's clickTolerance.
1991 */
1992 clickTolerance?: number | null | undefined;
1993
1994 /** The rotation angle of the marker in degrees, relative to its `rotationAlignment` setting. A positive value will rotate the marker clockwise.
1995 * The default value is 0.
1996 */
1997 rotation?: number | undefined;
1998
1999 /** `map` aligns the `Marker`'s rotation relative to the map, maintaining a bearing as the map rotates.
2000 * `viewport` aligns the `Marker`'s rotation relative to the viewport, agnostic to map rotations.
2001 * `auto` is equivalent to `viewport`.
2002 * The default value is `auto`
2003 */
2004 rotationAlignment?: Alignment | undefined;
2005
2006 /** `map` aligns the `Marker` to the plane of the map.
2007 * `viewport` aligns the `Marker` to the plane of the viewport.
2008 * `auto` automatically matches the value of `rotationAlignment`.
2009 * The default value is `auto`.
2010 */
2011 pitchAlignment?: Alignment | undefined;
2012
2013 /** The scale to use for the default marker if options.element is not provided.
2014 * The default scale (1) corresponds to a height of `41px` and a width of `27px`.
2015 */
2016 scale?: number | undefined;
2017
2018 /**
2019 * The opacity of a marker that's occluded by 3D terrain. Number between 0 and 1.
2020 */
2021 occludedOpacity?: number | undefined;
2022 }
2023
2024 type EventedListener = (object?: Object) => any;
2025 /**
2026 * Evented
2027 */
2028 export class Evented {
2029 on(type: string, listener: EventedListener): this;
2030
2031 off(type?: string | any, listener?: EventedListener): this;
2032
2033 once(type: string, listener: EventedListener): this;
2034
2035 // https://github.com/mapbox/mapbox-gl-js/issues/6522
2036 fire(type: string, properties?: { [key: string]: any }): this;
2037 }
2038
2039 /**
2040 * StyleOptions
2041 */
2042 export interface StyleOptions {
2043 transition?: boolean | undefined;
2044 }
2045
2046 export type MapboxGeoJSONFeature = GeoJSON.Feature<GeoJSON.Geometry> & {
2047 layer: Layer;
2048 source: string;
2049 sourceLayer: string;
2050 state: { [key: string]: any };
2051 };
2052
2053 export type EventData = { [key: string]: any };
2054
2055 export class MapboxEvent<TOrig = undefined> {
2056 type: string;
2057 target: Map;
2058 originalEvent: TOrig;
2059 }
2060
2061 export class MapMouseEvent extends MapboxEvent<MouseEvent> {
2062 type:
2063 | "mousedown"
2064 | "mouseup"
2065 | "click"
2066 | "dblclick"
2067 | "mousemove"
2068 | "mouseover"
2069 | "mouseenter"
2070 | "mouseleave"
2071 | "mouseout"
2072 | "contextmenu";
2073
2074 point: Point;
2075 lngLat: LngLat;
2076
2077 preventDefault(): void;
2078 defaultPrevented: boolean;
2079 }
2080
2081 export type MapLayerMouseEvent = MapMouseEvent & { features?: MapboxGeoJSONFeature[] | undefined };
2082
2083 export class MapTouchEvent extends MapboxEvent<TouchEvent> {
2084 type: "touchstart" | "touchend" | "touchcancel";
2085
2086 point: Point;
2087 lngLat: LngLat;
2088 points: Point[];
2089 lngLats: LngLat[];
2090
2091 preventDefault(): void;
2092 defaultPrevented: boolean;
2093 }
2094
2095 export type MapLayerTouchEvent = MapTouchEvent & { features?: MapboxGeoJSONFeature[] | undefined };
2096
2097 export class MapWheelEvent extends MapboxEvent<WheelEvent> {
2098 type: "wheel";
2099
2100 preventDefault(): void;
2101 defaultPrevented: boolean;
2102 }
2103
2104 export interface MapBoxZoomEvent extends MapboxEvent<MouseEvent> {
2105 type: "boxzoomstart" | "boxzoomend" | "boxzoomcancel";
2106
2107 boxZoomBounds: LngLatBounds;
2108 }
2109
2110 export type MapDataEvent = MapSourceDataEvent | MapStyleDataEvent;
2111
2112 export interface MapStyleDataEvent extends MapboxEvent {
2113 dataType: "style";
2114 }
2115
2116 export interface MapSourceDataEvent extends MapboxEvent {
2117 dataType: "source";
2118 isSourceLoaded: boolean;
2119 source: Source;
2120 sourceId: string;
2121 sourceDataType: "metadata" | "content";
2122 tile: any;
2123 coord: Coordinate;
2124 }
2125
2126 export interface Coordinate {
2127 canonical: CanonicalCoordinate;
2128 wrap: number;
2129 key: number;
2130 }
2131
2132 export interface CanonicalCoordinate {
2133 x: number;
2134 y: number;
2135 z: number;
2136 key: number;
2137 equals(coord: CanonicalCoordinate): boolean;
2138 }
2139
2140 export interface MapContextEvent extends MapboxEvent<WebGLContextEvent> {
2141 type: "webglcontextlost" | "webglcontextrestored";
2142 }
2143
2144 export class ErrorEvent extends MapboxEvent {
2145 type: "error";
2146 error: Error;
2147 }
2148
2149 /**
2150 * FilterOptions
2151 */
2152 export interface FilterOptions {
2153 /**
2154 * Whether to check if the filter conforms to the Mapbox GL Style Specification.
2155 * Disabling validation is a performance optimization that should only be used
2156 * if you have previously validated the values you will be passing to this function.
2157 */
2158 validate?: boolean | null | undefined;
2159 }
2160
2161 /**
2162 * AnimationOptions
2163 */
2164 export interface AnimationOptions {
2165 /** Number in milliseconds */
2166 duration?: number | undefined;
2167 /**
2168 * A function taking a time in the range 0..1 and returning a number where 0 is the initial
2169 * state and 1 is the final state.
2170 */
2171 easing?: ((time: number) => number) | undefined;
2172 /** point, origin of movement relative to map center */
2173 offset?: PointLike | undefined;
2174 /** When set to false, no animation happens */
2175 animate?: boolean | undefined;
2176
2177 /** If `true`, then the animation is considered essential and will not be affected by `prefers-reduced-motion`.
2178 * Otherwise, the transition will happen instantly if the user has enabled the `reduced motion` accesibility feature in their operating system.
2179 */
2180 essential?: boolean | undefined;
2181 }
2182
2183 /**
2184 * CameraOptions
2185 */
2186 export interface CameraOptions {
2187 /** Map center */
2188 center?: LngLatLike | undefined;
2189 /** Map zoom level */
2190 zoom?: number | undefined;
2191 /** Map rotation bearing in degrees counter-clockwise from north */
2192 bearing?: number | undefined;
2193 /** Map angle in degrees at which the camera is looking at the ground */
2194 pitch?: number | undefined;
2195 /** If zooming, the zoom center (defaults to map center) */
2196 around?: LngLatLike | undefined;
2197 /** Dimensions in pixels applied on each side of the viewport for shifting the vanishing point. */
2198 padding?: number | PaddingOptions | undefined;
2199 }
2200
2201 export interface CameraForBoundsOptions extends CameraOptions {
2202 offset?: PointLike | undefined;
2203 maxZoom?: number | undefined;
2204 }
2205
2206 // The Mapbox docs say that if the result is defined, it will have zoom, center and bearing set.
2207 // In practice center is always a {lat, lng} object.
2208 export type CameraForBoundsResult = Required<Pick<CameraOptions, "zoom" | "bearing">> & {
2209 /** Map center */
2210 center: { lng: number; lat: number };
2211 };
2212
2213 /**
2214 * FlyToOptions
2215 */
2216 export interface FlyToOptions extends AnimationOptions, CameraOptions {
2217 curve?: number | undefined;
2218 minZoom?: number | undefined;
2219 speed?: number | undefined;
2220 screenSpeed?: number | undefined;
2221 maxDuration?: number | undefined;
2222 }
2223
2224 /**
2225 * EaseToOptions
2226 */
2227 export interface EaseToOptions extends AnimationOptions, CameraOptions {
2228 delayEndEvents?: number | undefined;
2229 }
2230
2231 export interface FitBoundsOptions extends mapboxgl.FlyToOptions {
2232 linear?: boolean | undefined;
2233 offset?: mapboxgl.PointLike | undefined;
2234 maxZoom?: number | undefined;
2235 maxDuration?: number | undefined;
2236 }
2237
2238 /**
2239 * MapEvent
2240 */
2241 export type MapEventType = {
2242 error: ErrorEvent;
2243
2244 load: MapboxEvent;
2245 idle: MapboxEvent;
2246 remove: MapboxEvent;
2247 render: MapboxEvent;
2248 resize: MapboxEvent;
2249
2250 webglcontextlost: MapContextEvent;
2251 webglcontextrestored: MapContextEvent;
2252
2253 dataloading: MapDataEvent;
2254 data: MapDataEvent;
2255 tiledataloading: MapDataEvent;
2256 sourcedataloading: MapSourceDataEvent;
2257 styledataloading: MapStyleDataEvent;
2258 sourcedata: MapSourceDataEvent;
2259 styledata: MapStyleDataEvent;
2260 "style.load": MapboxEvent;
2261 "style.import.load": MapboxEvent;
2262
2263 boxzoomcancel: MapBoxZoomEvent;
2264 boxzoomstart: MapBoxZoomEvent;
2265 boxzoomend: MapBoxZoomEvent;
2266
2267 touchcancel: MapTouchEvent;
2268 touchmove: MapTouchEvent;
2269 touchend: MapTouchEvent;
2270 touchstart: MapTouchEvent;
2271
2272 click: MapMouseEvent;
2273 contextmenu: MapMouseEvent;
2274 dblclick: MapMouseEvent;
2275 mousemove: MapMouseEvent;
2276 mouseup: MapMouseEvent;
2277 mousedown: MapMouseEvent;
2278 mouseout: MapMouseEvent;
2279 mouseover: MapMouseEvent;
2280
2281 movestart: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
2282 move: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
2283 moveend: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
2284
2285 zoomstart: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
2286 zoom: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
2287 zoomend: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
2288
2289 rotatestart: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2290 rotate: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2291 rotateend: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2292
2293 dragstart: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2294 drag: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2295 dragend: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2296
2297 pitchstart: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2298 pitch: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2299 pitchend: MapboxEvent<MouseEvent | TouchEvent | undefined>;
2300
2301 wheel: MapWheelEvent;
2302 };
2303
2304 export type MapLayerEventType = {
2305 click: MapLayerMouseEvent;
2306 dblclick: MapLayerMouseEvent;
2307 mousedown: MapLayerMouseEvent;
2308 mouseup: MapLayerMouseEvent;
2309 mousemove: MapLayerMouseEvent;
2310 mouseenter: MapLayerMouseEvent;
2311 mouseleave: MapLayerMouseEvent;
2312 mouseover: MapLayerMouseEvent;
2313 mouseout: MapLayerMouseEvent;
2314 contextmenu: MapLayerMouseEvent;
2315
2316 touchstart: MapLayerTouchEvent;
2317 touchend: MapLayerTouchEvent;
2318 touchcancel: MapLayerTouchEvent;
2319 };
2320
2321 export type AnyLayout =
2322 | BackgroundLayout
2323 | FillLayout
2324 | FillExtrusionLayout
2325 | LineLayout
2326 | SymbolLayout
2327 | RasterLayout
2328 | CircleLayout
2329 | HeatmapLayout
2330 | HillshadeLayout
2331 | SkyLayout;
2332
2333 export type AnyPaint =
2334 | BackgroundPaint
2335 | FillPaint
2336 | FillExtrusionPaint
2337 | LinePaint
2338 | SymbolPaint
2339 | RasterPaint
2340 | CirclePaint
2341 | HeatmapPaint
2342 | HillshadePaint
2343 | SkyPaint;
2344
2345 interface Layer {
2346 id: string;
2347 type: string;
2348
2349 metadata?: any;
2350 ref?: string | undefined;
2351
2352 source?: string | AnySourceData | undefined;
2353
2354 "source-layer"?: string | undefined;
2355
2356 minzoom?: number | undefined;
2357 maxzoom?: number | undefined;
2358
2359 interactive?: boolean | undefined;
2360
2361 filter?: any[] | undefined;
2362 layout?: AnyLayout | undefined;
2363 paint?: AnyPaint | undefined;
2364 }
2365
2366 interface BackgroundLayer extends Layer {
2367 type: "background";
2368 layout?: BackgroundLayout | undefined;
2369 paint?: BackgroundPaint | undefined;
2370 }
2371
2372 interface CircleLayer extends Layer {
2373 type: "circle";
2374 layout?: CircleLayout | undefined;
2375 paint?: CirclePaint | undefined;
2376 }
2377
2378 interface FillExtrusionLayer extends Layer {
2379 type: "fill-extrusion";
2380 layout?: FillExtrusionLayout | undefined;
2381 paint?: FillExtrusionPaint | undefined;
2382 }
2383
2384 interface FillLayer extends Layer {
2385 type: "fill";
2386 layout?: FillLayout | undefined;
2387 paint?: FillPaint | undefined;
2388 }
2389
2390 interface HeatmapLayer extends Layer {
2391 type: "heatmap";
2392 layout?: HeatmapLayout | undefined;
2393 paint?: HeatmapPaint | undefined;
2394 }
2395
2396 interface HillshadeLayer extends Layer {
2397 type: "hillshade";
2398 layout?: HillshadeLayout | undefined;
2399 paint?: HillshadePaint | undefined;
2400 }
2401
2402 interface LineLayer extends Layer {
2403 type: "line";
2404 layout?: LineLayout | undefined;
2405 paint?: LinePaint | undefined;
2406 }
2407
2408 interface RasterLayer extends Layer {
2409 type: "raster";
2410 layout?: RasterLayout | undefined;
2411 paint?: RasterPaint | undefined;
2412 }
2413
2414 interface SymbolLayer extends Layer {
2415 type: "symbol";
2416 layout?: SymbolLayout | undefined;
2417 paint?: SymbolPaint | undefined;
2418 }
2419
2420 interface SkyLayer extends Layer {
2421 type: "sky";
2422 layout?: SkyLayout | undefined;
2423 paint?: SkyPaint | undefined;
2424 }
2425
2426 export type AnyLayer =
2427 | BackgroundLayer
2428 | CircleLayer
2429 | FillExtrusionLayer
2430 | FillLayer
2431 | HeatmapLayer
2432 | HillshadeLayer
2433 | LineLayer
2434 | RasterLayer
2435 | SymbolLayer
2436 | CustomLayerInterface
2437 | SkyLayer;
2438
2439 // See https://docs.mapbox.com/mapbox-gl-js/api/#customlayerinterface
2440 export interface CustomLayerInterface {
2441 /** A unique layer id. */
2442 id: string;
2443
2444 /* The layer's type. Must be "custom". */
2445 type: "custom";
2446
2447 /* Either "2d" or "3d". Defaults to "2d". */
2448 renderingMode?: "2d" | "3d" | undefined;
2449
2450 /**
2451 * Optional method called when the layer has been removed from the Map with Map#removeLayer.
2452 * This gives the layer a chance to clean up gl resources and event listeners.
2453 * @param map The Map this custom layer was just added to.
2454 * @param gl The gl context for the map.
2455 */
2456 onRemove?(map: mapboxgl.Map, gl: WebGLRenderingContext): void;
2457
2458 /**
2459 * Optional method called when the layer has been added to the Map with Map#addLayer.
2460 * This gives the layer a chance to initialize gl resources and register event listeners.
2461 * @param map The Map this custom layer was just added to.
2462 * @param gl The gl context for the map.
2463 */
2464 onAdd?(map: mapboxgl.Map, gl: WebGLRenderingContext): void;
2465
2466 /**
2467 * Optional method called during a render frame to allow a layer to prepare resources
2468 * or render into a texture.
2469 *
2470 * The layer cannot make any assumptions about the current GL state and must bind a framebuffer
2471 * before rendering.
2472 * @param gl The map's gl context.
2473 * @param matrix The map's camera matrix. It projects spherical mercator coordinates to gl
2474 * coordinates. The mercator coordinate [0, 0] represents the top left corner of
2475 * the mercator world and [1, 1] represents the bottom right corner. When the
2476 * renderingMode is "3d" , the z coordinate is conformal. A box with identical
2477 * x, y, and z lengths in mercator units would be rendered as a cube.
2478 * MercatorCoordinate .fromLatLng can be used to project a LngLat to a mercator
2479 * coordinate.
2480 */
2481 prerender?(gl: WebGLRenderingContext, matrix: number[]): void;
2482
2483 /**
2484 * Called during a render frame allowing the layer to draw into the GL context.
2485 *
2486 * The layer can assume blending and depth state is set to allow the layer to properly blend
2487 * and clip other layers. The layer cannot make any other assumptions about the current GL state.
2488 *
2489 * If the layer needs to render to a texture, it should implement the prerender method to do this
2490 * and only use the render method for drawing directly into the main framebuffer.
2491 *
2492 * The blend function is set to gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA). This expects
2493 * colors to be provided in premultiplied alpha form where the r, g and b values are already
2494 * multiplied by the a value. If you are unable to provide colors in premultiplied form you may
2495 * want to change the blend function to
2496 * gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA).
2497 *
2498 * @param gl The map's gl context.
2499 * @param matrix The map's camera matrix. It projects spherical mercator coordinates to gl
2500 * coordinates. The mercator coordinate [0, 0] represents the top left corner of
2501 * the mercator world and [1, 1] represents the bottom right corner. When the
2502 * renderingMode is "3d" , the z coordinate is conformal. A box with identical
2503 * x, y, and z lengths in mercator units would be rendered as a cube.
2504 * MercatorCoordinate .fromLatLng can be used to project a LngLat to a mercator
2505 * coordinate.
2506 */
2507 render(gl: WebGLRenderingContext, matrix: number[]): void;
2508 }
2509
2510 export interface StyleFunction {
2511 stops?: any[][] | undefined;
2512 property?: string | undefined;
2513 base?: number | undefined;
2514 type?: "identity" | "exponential" | "interval" | "categorical" | undefined;
2515 default?: any;
2516 colorSpace?: "rgb" | "lab" | "hcl" | undefined;
2517 }
2518
2519 type Visibility = "visible" | "none";
2520
2521 export interface Layout {
2522 visibility?: Visibility | undefined;
2523 }
2524
2525 export interface BackgroundLayout extends Layout {}
2526
2527 export interface BackgroundPaint {
2528 "background-color"?: string | Expression | undefined;
2529 "background-color-transition"?: Transition | undefined;
2530 "background-pattern"?: string | undefined;
2531 "background-pattern-transition"?: Transition | undefined;
2532 "background-opacity"?: number | Expression | undefined;
2533 "background-opacity-transition"?: Transition | undefined;
2534 "background-emissive-strength"?: number | Expression | undefined;
2535 }
2536
2537 export interface FillLayout extends Layout {
2538 "fill-sort-key"?: number | Expression | undefined;
2539 }
2540
2541 export interface FillPaint {
2542 "fill-antialias"?: boolean | Expression | undefined;
2543 "fill-opacity"?: number | StyleFunction | Expression | undefined;
2544 "fill-opacity-transition"?: Transition | undefined;
2545 "fill-color"?: string | StyleFunction | Expression | undefined;
2546 "fill-color-transition"?: Transition | undefined;
2547 "fill-outline-color"?: string | StyleFunction | Expression | undefined;
2548 "fill-outline-color-transition"?: Transition | undefined;
2549 "fill-translate"?: number[] | undefined;
2550 "fill-translate-transition"?: Transition | undefined;
2551 "fill-translate-anchor"?: "map" | "viewport" | undefined;
2552 "fill-pattern"?: string | Expression | undefined;
2553 "fill-pattern-transition"?: Transition | undefined;
2554 "fill-emissive-strength"?: number | Expression | undefined;
2555 "fill-extrusion-ambient-occlusion-ground-attenuation"?: number | Expression | undefined;
2556 "fill-extrusion-ambient-occlusion-ground-radius"?: number | Expression | undefined;
2557 "fill-extrusion-ambient-occlusion-wall-radius"?: number | Expression | undefined;
2558 "fill-extrusion-flood-light-color"?: string | StyleFunction | Expression | undefined;
2559 "fill-extrusion-flood-light-ground-attenuation"?: number | Expression | undefined;
2560 "fill-extrusion-flood-light-ground-radius"?: number | Expression | undefined;
2561 "fill-extrusion-flood-light-intensity"?: number | Expression | undefined;
2562 "fill-extrusion-flood-light-wall-radius"?: number | Expression | undefined;
2563 "fill-extrusion-vertical-scale"?: number | Expression | undefined;
2564 }
2565
2566 export interface FillExtrusionLayout extends Layout {}
2567
2568 export interface FillExtrusionPaint {
2569 "fill-extrusion-opacity"?: number | Expression | undefined;
2570 "fill-extrusion-opacity-transition"?: Transition | undefined;
2571 "fill-extrusion-color"?: string | StyleFunction | Expression | undefined;
2572 "fill-extrusion-color-transition"?: Transition | undefined;
2573 "fill-extrusion-translate"?: number[] | Expression | undefined;
2574 "fill-extrusion-translate-transition"?: Transition | undefined;
2575 "fill-extrusion-translate-anchor"?: "map" | "viewport" | undefined;
2576 "fill-extrusion-pattern"?: string | Expression | undefined;
2577 "fill-extrusion-pattern-transition"?: Transition | undefined;
2578 "fill-extrusion-height"?: number | StyleFunction | Expression | undefined;
2579 "fill-extrusion-height-transition"?: Transition | undefined;
2580 "fill-extrusion-base"?: number | StyleFunction | Expression | undefined;
2581 "fill-extrusion-base-transition"?: Transition | undefined;
2582 "fill-extrusion-vertical-gradient"?: boolean | undefined;
2583 }
2584
2585 export interface LineLayout extends Layout {
2586 "line-cap"?: "butt" | "round" | "square" | Expression | undefined;
2587 "line-join"?: "bevel" | "round" | "miter" | Expression | undefined;
2588 "line-miter-limit"?: number | Expression | undefined;
2589 "line-round-limit"?: number | Expression | undefined;
2590 "line-sort-key"?: number | Expression | undefined;
2591 }
2592
2593 export interface LinePaint {
2594 "line-opacity"?: number | StyleFunction | Expression | undefined;
2595 "line-opacity-transition"?: Transition | undefined;
2596 "line-color"?: string | StyleFunction | Expression | undefined;
2597 "line-color-transition"?: Transition | undefined;
2598 "line-translate"?: number[] | Expression | undefined;
2599 "line-translate-transition"?: Transition | undefined;
2600 "line-translate-anchor"?: "map" | "viewport" | undefined;
2601 "line-width"?: number | StyleFunction | Expression | undefined;
2602 "line-width-transition"?: Transition | undefined;
2603 "line-gap-width"?: number | StyleFunction | Expression | undefined;
2604 "line-gap-width-transition"?: Transition | undefined;
2605 "line-offset"?: number | StyleFunction | Expression | undefined;
2606 "line-offset-transition"?: Transition | undefined;
2607 "line-blur"?: number | StyleFunction | Expression | undefined;
2608 "line-blur-transition"?: Transition | undefined;
2609 "line-dasharray"?: number[] | Expression | undefined;
2610 "line-dasharray-transition"?: Transition | undefined;
2611 "line-pattern"?: string | Expression | undefined;
2612 "line-pattern-transition"?: Transition | undefined;
2613 "line-gradient"?: Expression | undefined;
2614 "line-emissive-strength"?: number | Expression | undefined;
2615 }
2616
2617 export interface SymbolLayout extends Layout {
2618 "symbol-placement"?: "point" | "line" | "line-center" | undefined;
2619 "symbol-spacing"?: number | Expression | undefined;
2620 "symbol-avoid-edges"?: boolean | undefined;
2621 "symbol-z-order"?: "viewport-y" | "source" | undefined;
2622 "icon-allow-overlap"?: boolean | StyleFunction | Expression | undefined;
2623 "icon-ignore-placement"?: boolean | Expression | undefined;
2624 "icon-optional"?: boolean | undefined;
2625 "icon-rotation-alignment"?: "map" | "viewport" | "auto" | undefined;
2626 "icon-size"?: number | StyleFunction | Expression | undefined;
2627 "icon-text-fit"?: "none" | "both" | "width" | "height" | undefined;
2628 "icon-text-fit-padding"?: number[] | Expression | undefined;
2629 "icon-image"?: string | StyleFunction | Expression | undefined;
2630 "icon-rotate"?: number | StyleFunction | Expression | undefined;
2631 "icon-padding"?: number | Expression | undefined;
2632 "icon-keep-upright"?: boolean | undefined;
2633 "icon-offset"?: number[] | StyleFunction | Expression | undefined;
2634 "icon-anchor"?: Anchor | StyleFunction | Expression | undefined;
2635 "icon-pitch-alignment"?: "map" | "viewport" | "auto" | undefined;
2636 "text-pitch-alignment"?: "map" | "viewport" | "auto" | undefined;
2637 "text-rotation-alignment"?: "map" | "viewport" | "auto" | undefined;
2638 "text-field"?: string | StyleFunction | Expression | undefined;
2639 "text-font"?: string[] | Expression | undefined;
2640 "text-size"?: number | StyleFunction | Expression | undefined;
2641 "text-max-width"?: number | StyleFunction | Expression | undefined;
2642 "text-line-height"?: number | Expression | undefined;
2643 "text-letter-spacing"?: number | Expression | undefined;
2644 "text-justify"?: "auto" | "left" | "center" | "right" | Expression | undefined;
2645 "text-anchor"?: Anchor | StyleFunction | Expression | undefined;
2646 "text-max-angle"?: number | Expression | undefined;
2647 "text-rotate"?: number | StyleFunction | Expression | undefined;
2648 "text-padding"?: number | Expression | undefined;
2649 "text-keep-upright"?: boolean | undefined;
2650 "text-transform"?: "none" | "uppercase" | "lowercase" | StyleFunction | Expression | undefined;
2651 "text-offset"?: number[] | Expression | undefined;
2652 "text-allow-overlap"?: boolean | undefined;
2653 "text-ignore-placement"?: boolean | undefined;
2654 "text-optional"?: boolean | undefined;
2655 "text-radial-offset"?: number | Expression | undefined;
2656 "text-variable-anchor"?: Anchor[] | undefined;
2657 "text-writing-mode"?: Array<"horizontal" | "vertical"> | undefined;
2658 "symbol-sort-key"?: number | Expression | undefined;
2659 }
2660
2661 export interface SymbolPaint {
2662 "icon-opacity"?: number | StyleFunction | Expression | undefined;
2663 "icon-opacity-transition"?: Transition | undefined;
2664 "icon-color"?: string | StyleFunction | Expression | undefined;
2665 "icon-color-transition"?: Transition | undefined;
2666 "icon-halo-color"?: string | StyleFunction | Expression | undefined;
2667 "icon-halo-color-transition"?: Transition | undefined;
2668 "icon-halo-width"?: number | StyleFunction | Expression | undefined;
2669 "icon-halo-width-transition"?: Transition | undefined;
2670 "icon-halo-blur"?: number | StyleFunction | Expression | undefined;
2671 "icon-halo-blur-transition"?: Transition | undefined;
2672 "icon-translate"?: number[] | Expression | undefined;
2673 "icon-translate-transition"?: Transition | undefined;
2674 "icon-translate-anchor"?: "map" | "viewport" | undefined;
2675 "icon-emissive-strength"?: number | StyleFunction | Expression | undefined;
2676 "icon-image-cross-fade"?: number | StyleFunction | Expression | undefined;
2677 "text-opacity"?: number | StyleFunction | Expression | undefined;
2678 "text-opacity-transition"?: Transition | undefined;
2679 "text-color"?: string | StyleFunction | Expression | undefined;
2680 "text-color-transition"?: Transition | undefined;
2681 "text-halo-color"?: string | StyleFunction | Expression | undefined;
2682 "text-halo-color-transition"?: Transition | undefined;
2683 "text-halo-width"?: number | StyleFunction | Expression | undefined;
2684 "text-halo-width-transition"?: Transition | undefined;
2685 "text-halo-blur"?: number | StyleFunction | Expression | undefined;
2686 "text-halo-blur-transition"?: Transition | undefined;
2687 "text-translate"?: number[] | Expression | undefined;
2688 "text-translate-transition"?: Transition | undefined;
2689 "text-translate-anchor"?: "map" | "viewport" | undefined;
2690 "text-emissive-strength"?: number | StyleFunction | Expression | undefined;
2691 }
2692
2693 export interface RasterLayout extends Layout {}
2694
2695 export interface RasterPaint {
2696 "raster-opacity"?: number | Expression | undefined;
2697 "raster-opacity-transition"?: Transition | undefined;
2698 "raster-hue-rotate"?: number | Expression | undefined;
2699 "raster-hue-rotate-transition"?: Transition | undefined;
2700 "raster-brightness-min"?: number | Expression | undefined;
2701 "raster-brightness-min-transition"?: Transition | undefined;
2702 "raster-brightness-max"?: number | Expression | undefined;
2703 "raster-brightness-max-transition"?: Transition | undefined;
2704 "raster-saturation"?: number | Expression | undefined;
2705 "raster-saturation-transition"?: Transition | undefined;
2706 "raster-contrast"?: number | Expression | undefined;
2707 "raster-contrast-transition"?: Transition | undefined;
2708 "raster-fade-duration"?: number | Expression | undefined;
2709 "raster-resampling"?: "linear" | "nearest" | undefined;
2710 "raster-color"?: string | Expression | undefined;
2711 "raster-color-mix"?: [number, number, number, number] | Expression | undefined;
2712 "raster-color-range"?: [number, number] | Expression | undefined;
2713 }
2714
2715 export interface CircleLayout extends Layout {
2716 "circle-sort-key"?: number | Expression | undefined;
2717 }
2718
2719 export interface CirclePaint {
2720 "circle-radius"?: number | StyleFunction | Expression | undefined;
2721 "circle-radius-transition"?: Transition | undefined;
2722 "circle-color"?: string | StyleFunction | Expression | undefined;
2723 "circle-color-transition"?: Transition | undefined;
2724 "circle-blur"?: number | StyleFunction | Expression | undefined;
2725 "circle-blur-transition"?: Transition | undefined;
2726 "circle-opacity"?: number | StyleFunction | Expression | undefined;
2727 "circle-opacity-transition"?: Transition | undefined;
2728 "circle-translate"?: number[] | Expression | undefined;
2729 "circle-translate-transition"?: Transition | undefined;
2730 "circle-translate-anchor"?: "map" | "viewport" | undefined;
2731 "circle-pitch-scale"?: "map" | "viewport" | undefined;
2732 "circle-pitch-alignment"?: "map" | "viewport" | undefined;
2733 "circle-stroke-width"?: number | StyleFunction | Expression | undefined;
2734 "circle-stroke-width-transition"?: Transition | undefined;
2735 "circle-stroke-color"?: string | StyleFunction | Expression | undefined;
2736 "circle-stroke-color-transition"?: Transition | undefined;
2737 "circle-stroke-opacity"?: number | StyleFunction | Expression | undefined;
2738 "circle-stroke-opacity-transition"?: Transition | undefined;
2739 "circle-emissive-strength"?: number | StyleFunction | Expression | undefined;
2740 }
2741
2742 export interface HeatmapLayout extends Layout {}
2743
2744 export interface HeatmapPaint {
2745 "heatmap-radius"?: number | StyleFunction | Expression | undefined;
2746 "heatmap-radius-transition"?: Transition | undefined;
2747 "heatmap-weight"?: number | StyleFunction | Expression | undefined;
2748 "heatmap-intensity"?: number | StyleFunction | Expression | undefined;
2749 "heatmap-intensity-transition"?: Transition | undefined;
2750 "heatmap-color"?: string | StyleFunction | Expression | undefined;
2751 "heatmap-opacity"?: number | StyleFunction | Expression | undefined;
2752 "heatmap-opacity-transition"?: Transition | undefined;
2753 }
2754
2755 export interface HillshadeLayout extends Layout {}
2756
2757 export interface HillshadePaint {
2758 "hillshade-illumination-direction"?: number | Expression | undefined;
2759 "hillshade-illumination-anchor"?: "map" | "viewport" | undefined;
2760 "hillshade-exaggeration"?: number | Expression | undefined;
2761 "hillshade-exaggeration-transition"?: Transition | undefined;
2762 "hillshade-shadow-color"?: string | Expression | undefined;
2763 "hillshade-shadow-color-transition"?: Transition | undefined;
2764 "hillshade-highlight-color"?: string | Expression | undefined;
2765 "hillshade-highlight-color-transition"?: Transition | undefined;
2766 "hillshade-accent-color"?: string | Expression | undefined;
2767 "hillshade-accent-color-transition"?: Transition | undefined;
2768 }
2769
2770 export interface SkyLayout extends Layout {}
2771
2772 export interface SkyPaint {
2773 "sky-atmosphere-color"?: string | Expression | undefined;
2774 "sky-atmosphere-halo-color"?: string | Expression | undefined;
2775 "sky-atmosphere-sun"?: number[] | Expression | undefined;
2776 "sky-atmosphere-sun-intensity"?: number | Expression | undefined;
2777 "sky-gradient"?: string | Expression | undefined;
2778 "sky-gradient-center"?: number[] | Expression | undefined;
2779 "sky-gradient-radius"?: number | Expression | undefined;
2780 "sky-opacity"?: number | Expression | undefined;
2781 "sky-type"?: "gradient" | "atmosphere" | undefined;
2782 }
2783
2784 export type ElevationQueryOptions = {
2785 exaggerated: boolean;
2786 };
2787
2788 export interface Projection {
2789 name:
2790 | "albers"
2791 | "equalEarth"
2792 | "equirectangular"
2793 | "lambertConformalConic"
2794 | "mercator"
2795 | "naturalEarth"
2796 | "winkelTripel"
2797 | "globe";
2798 center?: [number, number];
2799 parallels?: [number, number];
2800 }
2801}
2802
\No newline at end of file