@milemaker/milemaker-js 1.0.0

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