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