@maptiler/sdk 2.2.1 → 2.3.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 (62) hide show
  1. package/biome.json +2 -1
  2. package/dist/maptiler-sdk.css +0 -1
  3. package/dist/maptiler-sdk.d.ts +1 -1785
  4. package/dist/maptiler-sdk.mjs +1782 -2617
  5. package/dist/maptiler-sdk.mjs.map +1 -1
  6. package/dist/src/MLAdapters/AttributionControl.d.ts +6 -0
  7. package/dist/src/MLAdapters/BoxZoomHandler.d.ts +8 -0
  8. package/dist/src/MLAdapters/CanvasSource.d.ts +6 -0
  9. package/dist/src/MLAdapters/CooperativeGesturesHandler.d.ts +6 -0
  10. package/dist/src/MLAdapters/FullscreenControl.d.ts +6 -0
  11. package/dist/src/MLAdapters/GeoJSONSource.d.ts +6 -0
  12. package/dist/src/MLAdapters/GeolocateControl.d.ts +6 -0
  13. package/dist/src/MLAdapters/ImageSource.d.ts +6 -0
  14. package/dist/src/MLAdapters/KeyboardHandler.d.ts +6 -0
  15. package/dist/src/MLAdapters/LogoControl.d.ts +6 -0
  16. package/dist/src/MLAdapters/MapMouseEvent.d.ts +6 -0
  17. package/dist/src/MLAdapters/MapTouchEvent.d.ts +6 -0
  18. package/dist/src/MLAdapters/MapWheelEvent.d.ts +6 -0
  19. package/dist/src/MLAdapters/Marker.d.ts +6 -0
  20. package/dist/src/MLAdapters/NavigationControl.d.ts +6 -0
  21. package/dist/src/MLAdapters/Popup.d.ts +6 -0
  22. package/dist/src/MLAdapters/RasterDEMTileSource.d.ts +6 -0
  23. package/dist/src/MLAdapters/RasterTileSource.d.ts +6 -0
  24. package/dist/src/MLAdapters/ScaleControl.d.ts +6 -0
  25. package/dist/src/MLAdapters/ScrollZoomHandler.d.ts +6 -0
  26. package/dist/src/MLAdapters/Style.d.ts +6 -0
  27. package/dist/src/MLAdapters/TerrainControl.d.ts +6 -0
  28. package/dist/src/MLAdapters/TwoFingersTouchPitchHandler.d.ts +6 -0
  29. package/dist/src/MLAdapters/VectorTileSource.d.ts +6 -0
  30. package/dist/src/MLAdapters/VideoSource.d.ts +6 -0
  31. package/dist/src/Map.d.ts +349 -0
  32. package/dist/src/MaptilerGeolocateControl.d.ts +21 -0
  33. package/dist/src/MaptilerLogoControl.d.ts +20 -0
  34. package/dist/src/MaptilerNavigationControl.d.ts +18 -0
  35. package/dist/src/MaptilerTerrainControl.d.ts +17 -0
  36. package/dist/src/Minimap.d.ts +58 -0
  37. package/dist/src/Point.d.ts +177 -0
  38. package/dist/src/caching.d.ts +5 -0
  39. package/dist/src/colorramp.d.ts +359 -0
  40. package/dist/src/config.d.ts +68 -0
  41. package/dist/src/converters/index.d.ts +1 -0
  42. package/dist/src/converters/xml.d.ts +54 -0
  43. package/dist/src/defaults.d.ts +14 -0
  44. package/dist/src/helpers/index.d.ts +14 -0
  45. package/dist/src/helpers/screenshot.d.ts +19 -0
  46. package/dist/src/helpers/stylehelper.d.ts +29 -0
  47. package/dist/src/helpers/vectorlayerhelpers.d.ts +509 -0
  48. package/dist/src/index.d.ts +89 -0
  49. package/dist/src/language.d.ts +108 -0
  50. package/dist/src/mapstyle.d.ts +3 -0
  51. package/dist/src/tools.d.ts +46 -0
  52. package/dist/src/unit.d.ts +1 -0
  53. package/package.json +15 -21
  54. package/readme.md +31 -0
  55. package/tsconfig.json +21 -8
  56. package/vite.config-es.ts +48 -0
  57. package/vite.config-umd.ts +27 -0
  58. package/.github/pull_request_template.md +0 -11
  59. package/.github/workflows/format-lint.yml +0 -21
  60. package/.github/workflows/npm-publish.yml +0 -22
  61. package/dist/maptiler-sdk.min.mjs +0 -3
  62. package/rollup.config.js +0 -147
@@ -1,1785 +1 @@
1
- import maplibregl__default, { LineLayerSpecification, FillLayerSpecification, StyleSpecification, ControlPosition, MapOptions as MapOptions$1, StyleSwapOptions, StyleOptions, LayerSpecification, SourceSpecification, CustomLayerInterface, FilterSpecification, StyleSetterOptions, RequestTransformFunction, Map as Map$1, GestureOptions, LogoControlOptions as LogoControlOptions$1, IControl } from 'maplibre-gl';
2
- export * from 'maplibre-gl';
3
- export { AJAXError, AttributionControl as AttributionControlMLGL, BoxZoomHandler as BoxZoomHandlerMLGL, CanvasSource as CanvasSourceMLGL, CooperativeGesturesHandler as CooperativeGesturesHandlerMLGL, DoubleClickZoomHandler, DragPanHandler, DragRotateHandler, EdgeInsets, Evented, FullscreenControl as FullscreenControlMLGL, GeoJSONSource as GeoJSONSourceMLGL, GeolocateControl as GeolocateControlMLGL, Hash, ImageSource as ImageSourceMLGL, KeyboardHandler as KeyboardHandlerMLGL, LngLat, LngLatBounds, LogoControl as LogoControlMLGL, Map as MapMLGL, MapMouseEvent as MapMouseEventMLGL, MapTouchEvent as MapTouchEventMLGL, MapWheelEvent as MapWheelEventMLGL, Marker as MarkerMLGL, MercatorCoordinate, NavigationControl as NavigationControlMLGL, Point, Popup as PopupMLGL, RasterDEMTileSource as RasterDEMTileSourceMLGL, RasterTileSource as RasterTileSourceMLGL, ScaleControl as ScaleControlMLGL, ScrollZoomHandler as ScrollZoomHandlerMLGL, Style as StyleMLGL, TerrainControl as TerrainControlMLGL, TwoFingersTouchPitchHandler as TwoFingersTouchPitchHandlerMLGL, TwoFingersTouchRotateHandler, TwoFingersTouchZoomHandler, TwoFingersTouchZoomRotateHandler, VectorTileSource as VectorTileSourceMLGL, VideoSource as VideoSourceMLGL, addProtocol, addSourceType, clearPrewarmedResources, config as configMLGL, getVersion as getMapLibreVersion, getMaxParallelImageRequests, getRTLTextPluginStatus, getWorkerCount, getWorkerUrl, importScriptInWorkers, prewarm, removeProtocol, setMaxParallelImageRequests, setRTLTextPlugin, setWorkerCount, setWorkerUrl } from 'maplibre-gl';
4
- import { FetchFunction, ReferenceMapStyle, MapStyleVariant } from '@maptiler/client';
5
- export { AutomaticStaticMapOptions, BoundedStaticMapOptions, BufferToPixelDataFunction, ByIdGeocodingOptions, CenteredStaticMapOptions, CommonForwardAndReverseGeocodingOptions, CoordinateExport, CoordinateGrid, CoordinateId, CoordinateSearch, CoordinateSearchResult, CoordinateTransformResult, CoordinateTransformation, Coordinates, CoordinatesSearchOptions, CoordinatesTransformOptions, DefaultTransformation, ElevationAtOptions, ElevationBatchOptions, FeatureHierarchy, FetchFunction, GeocodingFeature, GeocodingOptions, GeocodingSearchResult, GeolocationInfoOptions, GeolocationResult, GetDataOptions, LanguageGeocoding, LanguageGeocodingOptions, LanguageGeocodingString, MapStyle, MapStylePreset, MapStyleType, MapStyleVariant, PixelData, ReferenceMapStyle, ReverseGeocodingOptions, ServiceError, StaticMapBaseOptions, StaticMapMarker, TileJSON, XYZ, bufferToPixelDataBrowser, circumferenceAtLatitude, coordinates, data, elevation, expandMapStyle, geocoding, geolocation, getAutoLanguageGeocoding, getBufferToPixelDataParser, getTileCache, mapStylePresetList, math, misc, staticMaps, styleToStyle } from '@maptiler/client';
6
- import EventEmitter from 'events';
7
- import { FeatureCollection } from 'geojson';
8
-
9
- /**
10
- * Languages. Note that not all the languages of this list are available but the compatibility list may be expanded in the future.
11
- */
12
- declare const Language: {
13
- /**
14
- * The visitor language mode concatenates the prefered language from the user settings and the "default name".
15
- * Note: The "default name" is equivalent to OSM's `{name}`, which can be the most recognized names a global
16
- * scale or the local name.
17
- * This mode is helpful in the context where a user needs to access both the local names and the names in their
18
- * own language, for instance when traveling abroad, where signs likely to be only available in the local language.
19
- */
20
- readonly VISITOR: "visitor";
21
- /**
22
- * The visitor language mode concatenates English and the "default name".
23
- * Note: The "default name" is equivalent to OSM's `{name}`, which can be the most recognized names a global
24
- * scale or the local name.
25
- * This mode is helpful in the context where a user needs to access both the local names and the names in their
26
- * own language, for instance when traveling abroad, where signs likely to be only available in the local language.
27
- */
28
- readonly VISITOR_ENGLISH: "visitor_en";
29
- /**
30
- * Language as the style is designed. Not that this is the default state and one
31
- * the language has been changed to another than `STYLE`, then it cannot be set back to `STYLE`.
32
- */
33
- readonly STYLE: "style";
34
- /**
35
- * AUTO mode uses the language of the browser
36
- */
37
- readonly AUTO: "auto";
38
- /**
39
- * STYLE is a custom flag to keep the language of the map as defined into the style.
40
- * If STYLE is set in the constructor, then further modification of the language
41
- * with `.setLanguage()` is not possible.
42
- */
43
- readonly STYLE_LOCK: "style_lock";
44
- /**
45
- * Default fallback languages that uses latin charaters
46
- */
47
- readonly LATIN: "name:latin";
48
- /**
49
- * Default fallback languages that uses non-latin charaters
50
- */
51
- readonly NON_LATIN: "name:nonlatin";
52
- /**
53
- * Labels are in their local language, when available
54
- */
55
- readonly LOCAL: "name";
56
- /**
57
- * International name
58
- */
59
- readonly INTERNATIONAL: "name_int";
60
- readonly ALBANIAN: "name:sq";
61
- readonly AMHARIC: "name:am";
62
- readonly ARABIC: "name:ar";
63
- readonly ARMENIAN: "name:hy";
64
- readonly AZERBAIJANI: "name:az";
65
- readonly BASQUE: "name:eu";
66
- readonly BELORUSSIAN: "name:be";
67
- readonly BENGALI: "name:bn";
68
- readonly BOSNIAN: "name:bs";
69
- readonly BRETON: "name:br";
70
- readonly BULGARIAN: "name:bg";
71
- readonly CATALAN: "name:ca";
72
- readonly CHINESE: "name:zh";
73
- readonly TRADITIONAL_CHINESE: "name:zh-Hant";
74
- readonly SIMPLIFIED_CHINESE: "name:zh-Hans";
75
- readonly CORSICAN: "name:co";
76
- readonly CROATIAN: "name:hr";
77
- readonly CZECH: "name:cs";
78
- readonly DANISH: "name:da";
79
- readonly DUTCH: "name:nl";
80
- readonly ENGLISH: "name:en";
81
- readonly ESPERANTO: "name:eo";
82
- readonly ESTONIAN: "name:et";
83
- readonly FINNISH: "name:fi";
84
- readonly FRENCH: "name:fr";
85
- readonly FRISIAN: "name:fy";
86
- readonly GEORGIAN: "name:ka";
87
- readonly GERMAN: "name:de";
88
- readonly GREEK: "name:el";
89
- readonly HEBREW: "name:he";
90
- readonly HINDI: "name:hi";
91
- readonly HUNGARIAN: "name:hu";
92
- readonly ICELANDIC: "name:is";
93
- readonly INDONESIAN: "name:id";
94
- readonly IRISH: "name:ga";
95
- readonly ITALIAN: "name:it";
96
- readonly JAPANESE: "name:ja";
97
- readonly JAPANESE_HIRAGANA: "name:ja-Hira";
98
- readonly JAPANESE_KANA: "name:ja_kana";
99
- readonly JAPANESE_LATIN: "name:ja_rm";
100
- readonly JAPANESE_2018: "name:ja-Latn";
101
- readonly KANNADA: "name:kn";
102
- readonly KAZAKH: "name:kk";
103
- readonly KOREAN: "name:ko";
104
- readonly KOREAN_LATIN: "name:ko-Latn";
105
- readonly KURDISH: "name:ku";
106
- readonly ROMAN_LATIN: "name:la";
107
- readonly LATVIAN: "name:lv";
108
- readonly LITHUANIAN: "name:lt";
109
- readonly LUXEMBOURGISH: "name:lb";
110
- readonly MACEDONIAN: "name:mk";
111
- readonly MALAYALAM: "name:ml";
112
- readonly MALTESE: "name:mt";
113
- readonly NORWEGIAN: "name:no";
114
- readonly OCCITAN: "name:oc";
115
- readonly PERSIAN: "name:fa";
116
- readonly POLISH: "name:pl";
117
- readonly PORTUGUESE: "name:pt";
118
- readonly PUNJABI: "name:pa";
119
- readonly WESTERN_PUNJABI: "name:pnb";
120
- readonly ROMANIAN: "name:ro";
121
- readonly ROMANSH: "name:rm";
122
- readonly RUSSIAN: "name:ru";
123
- readonly SCOTTISH_GAELIC: "name:gd";
124
- readonly SERBIAN_CYRILLIC: "name:sr";
125
- readonly SERBIAN_LATIN: "name:sr-Latn";
126
- readonly SLOVAK: "name:sk";
127
- readonly SLOVENE: "name:sl";
128
- readonly SPANISH: "name:es";
129
- readonly SWEDISH: "name:sv";
130
- readonly TAMIL: "name:ta";
131
- readonly TELUGU: "name:te";
132
- readonly THAI: "name:th";
133
- readonly TURKISH: "name:tr";
134
- readonly UKRAINIAN: "name:uk";
135
- readonly URDU: "name:ur";
136
- readonly VIETNAMIAN_LATIN: "name:vi";
137
- readonly WELSH: "name:cy";
138
- };
139
- declare function isLanguageSupported(lang: string): boolean;
140
- /**
141
- * Type representing the key of the Language object
142
- */
143
- type LanguageKey = keyof typeof Language;
144
- type Values<T> = T[keyof T];
145
- /**
146
- * Built-in languages values as strings
147
- */
148
- type LanguageString = Values<typeof Language>;
149
- declare function getBrowserLanguage(): LanguageString;
150
-
151
- type Unit = "imperial" | "metric" | "nautical";
152
-
153
- /**
154
- * Configuration class for the SDK
155
- */
156
- declare class SdkConfig extends EventEmitter {
157
- /**
158
- * The primary language. By default, the language of the web browser is used.
159
- */
160
- primaryLanguage: LanguageString;
161
- /**
162
- * The secondary language, to overwrite the default language defined in the map style.
163
- * This settings is highly dependant on the style compatibility and may not work in most cases.
164
- */
165
- secondaryLanguage?: LanguageString;
166
- /**
167
- * Setting on whether of not the SDK runs with a session logic.
168
- * A "session" is started at the initialization of the SDK and finished when the browser
169
- * page is being refreshed.
170
- * When `session` is enabled (default: true), the extra URL param `mtsid` is added to queries
171
- * on the MapTiler Cloud API. This allows MapTiler to enable "session based billing".
172
- */
173
- session: boolean;
174
- /**
175
- * Enables client-side caching of requests for tiles and fonts.
176
- * The cached requests persist multiple browser sessions and will be reused when possible.
177
- * Works only for requests to the MapTiler Cloud API when sessions are enabled.
178
- */
179
- caching: boolean;
180
- /**
181
- * Unit to be used
182
- */
183
- private _unit;
184
- /**
185
- * MapTiler Cloud API key
186
- */
187
- private _apiKey;
188
- /**
189
- * Set the unit system
190
- */
191
- set unit(u: Unit);
192
- /**
193
- * Get the unit system
194
- */
195
- get unit(): Unit;
196
- /**
197
- * Set the MapTiler Cloud API key
198
- */
199
- set apiKey(k: string);
200
- /**
201
- * Get the MapTiler Cloud API key
202
- */
203
- get apiKey(): string;
204
- /**
205
- * Set a the custom fetch function to replace the default one
206
- */
207
- set fetch(f: FetchFunction);
208
- /**
209
- * Get the fetch fucntion
210
- */
211
- get fetch(): FetchFunction | null;
212
- }
213
- declare const config: SdkConfig;
214
-
215
- /**
216
- * This is an extension adds support for adding a minimap to one of the map's control containers.
217
- */
218
-
219
- interface ParentRect {
220
- lineLayout: LineLayerSpecification["layout"];
221
- linePaint: LineLayerSpecification["paint"];
222
- fillPaint: FillLayerSpecification["paint"];
223
- }
224
- interface MinimapOptionsInput {
225
- /**
226
- * Style of the map. Can be:
227
- * - a full style URL (possibly with API key)
228
- * - a shorthand with only the MapTIler style name (eg. `"streets-v2"`)
229
- * - a longer form with the prefix `"maptiler://"` (eg. `"maptiler://streets-v2"`)
230
- */
231
- style?: ReferenceMapStyle | MapStyleVariant | StyleSpecification | string;
232
- /**
233
- * Set the zoom difference between the parent and the minimap
234
- * If the parent is zoomed to 10 and the minimap is zoomed to 8, the zoomAdjust should be 2
235
- * Default: -4
236
- */
237
- zoomAdjust?: number;
238
- /** Set a zoom of the minimap and don't allow any future changes */
239
- lockZoom?: number;
240
- /** Adjust the pitch only if the user requests */
241
- pitchAdjust?: boolean;
242
- /** Set CSS properties of the container using object key-values */
243
- containerStyle?: Record<string, string>;
244
- /** Set the position of the minimap at either "top-left", "top-right", "bottom-left", or "bottom-right" */
245
- position?: ControlPosition;
246
- /** Set the parentRect fill and/or line options */
247
- parentRect?: ParentRect;
248
- }
249
- interface MinimapOptions extends MapOptions {
250
- zoomAdjust: number;
251
- pitchAdjust: boolean;
252
- containerStyle: Record<string, string>;
253
- parentRect?: ParentRect;
254
- }
255
-
256
- type LoadWithTerrainEvent = {
257
- type: "loadWithTerrain";
258
- target: Map;
259
- terrain: {
260
- source: string;
261
- exaggeration: number;
262
- };
263
- };
264
- declare const GeolocationType: {
265
- POINT: "POINT";
266
- COUNTRY: "COUNTRY";
267
- };
268
- /**
269
- * Options to provide to the `Map` constructor
270
- */
271
- type MapOptions = Omit<MapOptions$1, "style" | "maplibreLogo"> & {
272
- /**
273
- * Style of the map. Can be:
274
- * - a full style URL (possibly with API key)
275
- * - a shorthand with only the MapTIler style name (eg. `"streets-v2"`)
276
- * - a longer form with the prefix `"maptiler://"` (eg. `"maptiler://streets-v2"`)
277
- */
278
- style?: ReferenceMapStyle | MapStyleVariant | StyleSpecification | string;
279
- /**
280
- * Define the language of the map. This can be done directly with a language ISO code (eg. "en")
281
- * or with a built-in shorthand (eg. Language.ENGLISH).
282
- * Note that this is equivalent to setting the `config.primaryLanguage` and will overwrite it.
283
- */
284
- language?: LanguageString;
285
- /**
286
- * Define the MapTiler Cloud API key to be used. This is strictly equivalent to setting
287
- * `config.apiKey` and will overwrite it.
288
- */
289
- apiKey?: string;
290
- /**
291
- * Shows or hides the MapTiler logo in the bottom left corner.
292
- *
293
- * For paid plans:
294
- * - `true` shows MapTiler logo
295
- * - `false` hodes MapTiler logo
296
- * - default: `false` (hide)
297
- *
298
- * For free plans: MapTiler logo always shows, regardless of the value.
299
- */
300
- maptilerLogo?: boolean;
301
- /**
302
- * Attribution text to show in an {@link AttributionControl}.
303
- */
304
- customAttribution?: string | Array<string>;
305
- /**
306
- * Enables 3D terrain if `true`. (default: `false`)
307
- */
308
- terrain?: boolean;
309
- /**
310
- * Exaggeration factor of the terrain. (default: `1`, no exaggeration)
311
- */
312
- terrainExaggeration?: number;
313
- /**
314
- * Show the navigation control. (default: `true`, will hide if `false`)
315
- */
316
- navigationControl?: boolean | ControlPosition;
317
- /**
318
- * Show the terrain control. (default: `false`, will show if `true`)
319
- */
320
- terrainControl?: boolean | ControlPosition;
321
- /**
322
- * Show the geolocate control. (default: `true`, will hide if `false`)
323
- */
324
- geolocateControl?: boolean | ControlPosition;
325
- /**
326
- * Show the scale control. (default: `false`, will show if `true`)
327
- */
328
- scaleControl?: boolean | ControlPosition;
329
- /**
330
- * Show the full screen control. (default: `false`, will show if `true`)
331
- */
332
- fullscreenControl?: boolean | ControlPosition;
333
- /**
334
- * Display a minimap in a user defined corner of the map. (default: `bottom-left` corner)
335
- * If set to true, the map will assume it is a minimap and forego the attribution control.
336
- */
337
- minimap?: boolean | ControlPosition | MinimapOptionsInput;
338
- /**
339
- * attributionControl
340
- */
341
- forceNoAttributionControl?: boolean;
342
- /**
343
- * Method to position the map at a given geolocation. Only if:
344
- * - `hash` is `false`
345
- * - `center` is not provided
346
- *
347
- * If the value is `true` of `"POINT"` (given by `GeolocationType.POINT`) then the positionning uses the MapTiler Cloud
348
- * Geolocation to find the non-GPS location point.
349
- * The zoom level can be provided in the `Map` constructor with the `zoom` option or will be `13` if not provided.
350
- *
351
- * If the value is `"COUNTRY"` (given by `GeolocationType.COUNTRY`) then the map is centered around the bounding box of the country.
352
- * In this case, the `zoom` option will be ignored.
353
- *
354
- * If the value is `false`, no geolocation is performed and the map centering and zooming depends on other options or on
355
- * the built-in defaults.
356
- *
357
- * If this option is non-false and the options `center` is also provided, then `center` prevails.
358
- *
359
- * Default: `false`
360
- */
361
- geolocate?: (typeof GeolocationType)[keyof typeof GeolocationType] | boolean;
362
- };
363
- /**
364
- * The Map class can be instanciated to display a map in a `<div>`
365
- */
366
- declare class Map extends maplibregl__default.Map {
367
- private isTerrainEnabled;
368
- private terrainExaggeration;
369
- private primaryLanguage;
370
- private terrainGrowing;
371
- private terrainFlattening;
372
- private minimap?;
373
- private forceLanguageUpdate;
374
- private languageAlwaysBeenStyle;
375
- private isReady;
376
- constructor(options: MapOptions);
377
- /**
378
- * Awaits for _this_ Map instance to be "loaded" and returns a Promise to the Map.
379
- * If _this_ Map instance is already loaded, the Promise is resolved directly,
380
- * otherwise, it is resolved as a result of the "load" event.
381
- * @returns
382
- */
383
- onLoadAsync(): Promise<Map>;
384
- /**
385
- * Awaits for _this_ Map instance to be "ready" and returns a Promise to the Map.
386
- * If _this_ Map instance is already ready, the Promise is resolved directly,
387
- * otherwise, it is resolved as a result of the "ready" event.
388
- * A map instance is "ready" when all the controls that can be managed by the contructor are
389
- * dealt with. This happens after the "load" event, due to the asynchronous nature
390
- * of some built-in controls.
391
- */
392
- onReadyAsync(): Promise<Map>;
393
- /**
394
- * Awaits for _this_ Map instance to be "loaded" as well as with terrain being non-null for the first time
395
- * and returns a Promise to the Map.
396
- * If _this_ Map instance is already loaded with terrain, the Promise is resolved directly,
397
- * otherwise, it is resolved as a result of the "loadWithTerrain" event.
398
- * @returns
399
- */
400
- onLoadWithTerrainAsync(): Promise<Map>;
401
- /**
402
- * Update the style of the map.
403
- * Can be:
404
- * - a full style URL (possibly with API key)
405
- * - a shorthand with only the MapTIler style name (eg. `"streets-v2"`)
406
- * - a longer form with the prefix `"maptiler://"` (eg. `"maptiler://streets-v2"`)
407
- */
408
- setStyle(style: null | ReferenceMapStyle | MapStyleVariant | StyleSpecification | string, options?: StyleSwapOptions & StyleOptions): this;
409
- /**
410
- * Adds a [MapLibre style layer](https://maplibre.org/maplibre-style-spec/layers)
411
- * to the map's style.
412
- *
413
- * A layer defines how data from a specified source will be styled. Read more about layer types
414
- * and available paint and layout properties in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/layers).
415
- *
416
- * @param layer - The layer to add,
417
- * conforming to either the MapLibre Style Specification's [layer definition](https://maplibre.org/maplibre-style-spec/layers) or,
418
- * less commonly, the {@link CustomLayerInterface} specification.
419
- * The MapLibre Style Specification's layer definition is appropriate for most layers.
420
- *
421
- * @param beforeId - The ID of an existing layer to insert the new layer before,
422
- * resulting in the new layer appearing visually beneath the existing layer.
423
- * If this argument is not specified, the layer will be appended to the end of the layers array
424
- * and appear visually above all other layers.
425
- *
426
- * @returns `this`
427
- */
428
- addLayer(layer: (LayerSpecification & {
429
- source?: string | SourceSpecification;
430
- }) | CustomLayerInterface, beforeId?: string): this;
431
- /**
432
- * Moves a layer to a different z-position.
433
- *
434
- * @param id - The ID of the layer to move.
435
- * @param beforeId - The ID of an existing layer to insert the new layer before. When viewing the map, the `id` layer will appear beneath the `beforeId` layer. If `beforeId` is omitted, the layer will be appended to the end of the layers array and appear above all other layers on the map.
436
- * @returns `this`
437
- *
438
- * @example
439
- * Move a layer with ID 'polygon' before the layer with ID 'country-label'. The `polygon` layer will appear beneath the `country-label` layer on the map.
440
- * ```ts
441
- * map.moveLayer('polygon', 'country-label');
442
- * ```
443
- */
444
- moveLayer(id: string, beforeId?: string): this;
445
- /**
446
- * Removes the layer with the given ID from the map's style.
447
- *
448
- * An {@link ErrorEvent} will be fired if the image parameter is invald.
449
- *
450
- * @param id - The ID of the layer to remove
451
- * @returns `this`
452
- *
453
- * @example
454
- * If a layer with ID 'state-data' exists, remove it.
455
- * ```ts
456
- * if (map.getLayer('state-data')) map.removeLayer('state-data');
457
- * ```
458
- */
459
- removeLayer(id: string): this;
460
- /**
461
- * Sets the zoom extent for the specified style layer. The zoom extent includes the
462
- * [minimum zoom level](https://maplibre.org/maplibre-style-spec/layers/#minzoom)
463
- * and [maximum zoom level](https://maplibre.org/maplibre-style-spec/layers/#maxzoom))
464
- * at which the layer will be rendered.
465
- *
466
- * Note: For style layers using vector sources, style layers cannot be rendered at zoom levels lower than the
467
- * minimum zoom level of the _source layer_ because the data does not exist at those zoom levels. If the minimum
468
- * zoom level of the source layer is higher than the minimum zoom level defined in the style layer, the style
469
- * layer will not be rendered at all zoom levels in the zoom range.
470
- */
471
- setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this;
472
- /**
473
- * Sets the filter for the specified style layer.
474
- *
475
- * Filters control which features a style layer renders from its source.
476
- * Any feature for which the filter expression evaluates to `true` will be
477
- * rendered on the map. Those that are false will be hidden.
478
- *
479
- * Use `setFilter` to show a subset of your source data.
480
- *
481
- * To clear the filter, pass `null` or `undefined` as the second parameter.
482
- */
483
- setFilter(layerId: string, filter?: FilterSpecification | null, options?: StyleSetterOptions): this;
484
- /**
485
- * Sets the value of a paint property in the specified style layer.
486
- *
487
- * @param layerId - The ID of the layer to set the paint property in.
488
- * @param name - The name of the paint property to set.
489
- * @param value - The value of the paint property to set.
490
- * Must be of a type appropriate for the property, as defined in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/).
491
- * @param options - Options object.
492
- * @returns `this`
493
- * @example
494
- * ```ts
495
- * map.setPaintProperty('my-layer', 'fill-color', '#faafee');
496
- * ```
497
- */
498
- setPaintProperty(layerId: string, name: string, value: any, options?: StyleSetterOptions): this;
499
- /**
500
- * Sets the value of a layout property in the specified style layer.
501
- * Layout properties define how the layer is styled.
502
- * Layout properties for layers of the same type are documented together.
503
- * Layers of different types have different layout properties.
504
- * See the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/) for the complete list of layout properties.
505
- * @param layerId - The ID of the layer to set the layout property in.
506
- * @param name - The name of the layout property to set.
507
- * @param value - The value of the layout property to set.
508
- * Must be of a type appropriate for the property, as defined in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/).
509
- * @param options - Options object.
510
- * @returns `this`
511
- */
512
- setLayoutProperty(layerId: string, name: string, value: any, options?: StyleSetterOptions): this;
513
- /**
514
- * Sets the value of the style's glyphs property.
515
- *
516
- * @param glyphsUrl - Glyph URL to set. Must conform to the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/glyphs/).
517
- * @param options - Options object.
518
- * @returns `this`
519
- * @example
520
- * ```ts
521
- * map.setGlyphs('https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf');
522
- * ```
523
- */
524
- setGlyphs(glyphsUrl: string | null, options?: StyleSetterOptions): this;
525
- private getStyleLanguage;
526
- /**
527
- * Define the primary language of the map. Note that not all the languages shorthands provided are available.
528
- */
529
- setLanguage(language: LanguageString | string): void;
530
- /**
531
- * Define the primary language of the map. Note that not all the languages shorthands provided are available.
532
- */
533
- private setPrimaryLanguage;
534
- /**
535
- * Get the primary language
536
- * @returns
537
- */
538
- getPrimaryLanguage(): LanguageString;
539
- /**
540
- * Get the exaggeration factor applied to the terrain
541
- * @returns
542
- */
543
- getTerrainExaggeration(): number;
544
- /**
545
- * Know if terrian is enabled or not
546
- * @returns
547
- */
548
- hasTerrain(): boolean;
549
- private growTerrain;
550
- /**
551
- * Enables the 3D terrain visualization
552
- */
553
- enableTerrain(exaggeration?: number): void;
554
- /**
555
- * Disable the 3D terrain visualization
556
- */
557
- disableTerrain(): void;
558
- /**
559
- * Sets the 3D terrain exageration factor.
560
- * If the terrain was not enabled prior to the call of this method,
561
- * the method `.enableTerrain()` will be called.
562
- * If `animate` is `true`, the terrain transformation will be animated in the span of 1 second.
563
- * If `animate` is `false`, no animated transition to the newly defined exaggeration.
564
- */
565
- setTerrainExaggeration(exaggeration: number, animate?: boolean): void;
566
- /**
567
- * Perform an action when the style is ready. It could be at the moment of calling this method
568
- * or later.
569
- */
570
- private onStyleReady;
571
- fitToIpBounds(): Promise<void>;
572
- centerOnIpPoint(zoom: number | undefined): Promise<void>;
573
- getCameraHash(): string;
574
- /**
575
- * Get the SDK config object.
576
- * This is convenient to dispatch the SDK configuration to externally built layers
577
- * that do not directly have access to the SDK configuration but do have access to a Map instance.
578
- */
579
- getSdkConfig(): SdkConfig;
580
- /**
581
- * Get the MapTiler session ID. Convenient to dispatch to externaly built component
582
- * that do not directly have access to the SDK configuration but do have access to a Map instance.
583
- * @returns
584
- */
585
- getMaptilerSessionId(): string;
586
- /**
587
- * Updates the requestManager's transform request with a new function.
588
- *
589
- * @param transformRequest A callback run before the Map makes a request for an external URL. The callback can be used to modify the url, set headers, or set the credentials property for cross-origin requests.
590
- * Expected to return an object with a `url` property and optionally `headers` and `credentials` properties
591
- *
592
- * @returns {Map} `this`
593
- *
594
- * @example
595
- * map.setTransformRequest((url: string, resourceType: string) => {});
596
- */
597
- setTransformRequest(transformRequest: RequestTransformFunction): this;
598
- }
599
-
600
- /**
601
- * This is an extension of MapLibre Marker to make it fully type compatible with the SDK
602
- */
603
-
604
- declare class Marker extends maplibregl__default.Marker {
605
- addTo(map: Map | Map$1): this;
606
- }
607
-
608
- /**
609
- * This is an extension of MapLibre Popup to make it fully type compatible with the SDK
610
- */
611
-
612
- declare class Popup extends maplibregl__default.Popup {
613
- addTo(map: Map | Map$1): this;
614
- }
615
-
616
- /**
617
- * This is an extension of MapLibre Style to make it fully type compatible with the SDK
618
- */
619
-
620
- declare class Style extends maplibregl__default.Style {
621
- constructor(map: Map, options?: StyleOptions);
622
- }
623
-
624
- /**
625
- * This is an extension of MapLibre CanvasSource to make it fully type compatible with the SDK
626
- */
627
-
628
- declare class CanvasSource extends maplibregl__default.CanvasSource {
629
- onAdd(map: Map | Map$1): void;
630
- }
631
-
632
- /**
633
- * This is an extension of MapLibre GeoJSONSource to make it fully type compatible with the SDK
634
- */
635
-
636
- declare class GeoJSONSource extends maplibregl__default.GeoJSONSource {
637
- onAdd(map: Map | Map$1): void;
638
- }
639
-
640
- /**
641
- * This is an extension of MapLibre ImageSource to make it fully type compatible with the SDK
642
- */
643
-
644
- declare class ImageSource extends maplibregl__default.ImageSource {
645
- onAdd(map: Map | Map$1): void;
646
- }
647
-
648
- /**
649
- * This is an extension of MapLibre RasterTileSource to make it fully type compatible with the SDK
650
- */
651
-
652
- declare class RasterTileSource extends maplibregl__default.RasterTileSource {
653
- onAdd(map: Map | Map$1): void;
654
- }
655
-
656
- /**
657
- * This is an extension of MapLibre RasterDEMTileSource to make it fully type compatible with the SDK
658
- */
659
-
660
- declare class RasterDEMTileSource extends maplibregl__default.RasterDEMTileSource {
661
- onAdd(map: Map | Map$1): void;
662
- }
663
-
664
- /**
665
- * This is an extension of MapLibre VectorTileSource to make it fully type compatible with the SDK
666
- */
667
-
668
- declare class VectorTileSource extends maplibregl__default.VectorTileSource {
669
- onAdd(map: Map | Map$1): void;
670
- }
671
-
672
- /**
673
- * This is an extension of MapLibre VideoSource to make it fully type compatible with the SDK
674
- */
675
-
676
- declare class VideoSource extends maplibregl__default.VideoSource {
677
- onAdd(map: Map | Map$1): void;
678
- }
679
-
680
- /**
681
- * This is an extension of MapLibre NavigationControl to make it fully type compatible with the SDK
682
- */
683
-
684
- declare class NavigationControl extends maplibregl__default.NavigationControl {
685
- onAdd(map: Map | Map$1): HTMLElement;
686
- }
687
-
688
- /**
689
- * This is an extension of MapLibre GeolocateControl to make it fully type compatible with the SDK
690
- */
691
-
692
- declare class GeolocateControl extends maplibregl__default.GeolocateControl {
693
- onAdd(map: Map | Map$1): HTMLElement;
694
- }
695
-
696
- /**
697
- * This is an extension of MapLibre AttributionControl to make it fully type compatible with the SDK
698
- */
699
-
700
- declare class AttributionControl extends maplibregl__default.AttributionControl {
701
- onAdd(map: Map | Map$1): HTMLElement;
702
- }
703
-
704
- /**
705
- * This is an extension of MapLibre LogoControl to make it fully type compatible with the SDK
706
- */
707
-
708
- declare class LogoControl extends maplibregl__default.LogoControl {
709
- onAdd(map: Map | Map$1): HTMLElement;
710
- }
711
-
712
- /**
713
- * This is an extension of MapLibre ScaleControl to make it fully type compatible with the SDK
714
- */
715
-
716
- declare class ScaleControl extends maplibregl__default.ScaleControl {
717
- onAdd(map: Map | Map$1): HTMLElement;
718
- }
719
-
720
- /**
721
- * This is an extension of MapLibre FullscreenControl to make it fully type compatible with the SDK
722
- */
723
-
724
- declare class FullscreenControl extends maplibregl__default.FullscreenControl {
725
- onAdd(map: Map | Map$1): HTMLElement;
726
- }
727
-
728
- /**
729
- * This is an extension of MapLibre TerrainControl to make it fully type compatible with the SDK
730
- */
731
-
732
- declare class TerrainControl extends maplibregl__default.TerrainControl {
733
- onAdd(map: Map | Map$1): HTMLElement;
734
- }
735
-
736
- /**
737
- * This is an extension of MapLibre BoxZoomHandler to make it fully type compatible with the SDK
738
- */
739
-
740
- declare class BoxZoomHandler extends maplibregl__default.BoxZoomHandler {
741
- constructor(map: Map | Map$1, options: {
742
- clickTolerance: number;
743
- });
744
- }
745
-
746
- /**
747
- * This is an extension of MapLibre BoxZoomHandler to make it fully type compatible with the SDK
748
- */
749
-
750
- declare class ScrollZoomHandler extends maplibregl__default.ScrollZoomHandler {
751
- constructor(map: Map | Map$1, triggerRenderFrame: () => void);
752
- }
753
-
754
- /**
755
- * This is an extension of MapLibre BoxZoomHandler to make it fully type compatible with the SDK
756
- */
757
-
758
- declare class CooperativeGesturesHandler extends maplibregl__default.CooperativeGesturesHandler {
759
- constructor(map: Map | Map$1, options: GestureOptions);
760
- }
761
-
762
- /**
763
- * This is an extension of MapLibre BoxZoomHandler to make it fully type compatible with the SDK
764
- */
765
-
766
- declare class KeyboardHandler extends maplibregl__default.KeyboardHandler {
767
- constructor(map: Map | Map$1);
768
- }
769
-
770
- /**
771
- * This is an extension of MapLibre BoxZoomHandler to make it fully type compatible with the SDK
772
- */
773
-
774
- declare class TwoFingersTouchPitchHandler extends maplibregl__default.TwoFingersTouchPitchHandler {
775
- constructor(map: Map | Map$1);
776
- }
777
-
778
- /**
779
- * This is an extension of MapLibre BoxZoomHandler to make it fully type compatible with the SDK
780
- */
781
-
782
- declare class MapWheelEvent extends maplibregl__default.MapWheelEvent {
783
- constructor(type: string, map: Map | Map$1, originalEvent: WheelEvent);
784
- }
785
-
786
- /**
787
- * This is an extension of MapLibre BoxZoomHandler to make it fully type compatible with the SDK
788
- */
789
-
790
- declare class MapTouchEvent extends maplibregl__default.MapTouchEvent {
791
- constructor(type: string, map: Map | Map$1, originalEvent: TouchEvent);
792
- }
793
-
794
- /**
795
- * This is an extension of MapLibre BoxZoomHandler to make it fully type compatible with the SDK
796
- */
797
-
798
- declare class MapMouseEvent extends maplibregl__default.MapMouseEvent {
799
- constructor(type: string, map: Map | Map$1, originalEvent: MouseEvent, data?: any);
800
- }
801
-
802
- /**
803
- * The MaptilerGeolocateControl is an extension of the original GeolocateControl
804
- * with a few changes. In this version, the active mode persists as long as the
805
- * location is still centered. This means it's robust to rotation, pitch and zoom.
806
- *
807
- */
808
- declare class MaptilerGeolocateControl extends GeolocateControl {
809
- private lastUpdatedCenter;
810
- /**
811
- * Update the camera location to center on the current position
812
- *
813
- * @param {Position} position the Geolocation API Position
814
- * @private
815
- */
816
- _updateCamera: (position: GeolocationPosition) => void;
817
- _setupUI: (supported: boolean) => void;
818
- _updateCircleRadius(): void;
819
- _onZoom: () => void;
820
- }
821
-
822
- type LogoControlOptions = LogoControlOptions$1 & {
823
- logoURL?: string;
824
- linkURL?: string;
825
- };
826
- /**
827
- * This LogoControl extends the MapLibre LogoControl but instead can use any image URL and
828
- * any link URL. By default this is using MapTiler logo and URL.
829
- */
830
- declare class MaptilerLogoControl extends LogoControl {
831
- _compact: boolean;
832
- private logoURL;
833
- private linkURL;
834
- constructor(options?: LogoControlOptions);
835
- onAdd(map: Map): HTMLElement;
836
- }
837
-
838
- /**
839
- * A `MaptilerTerrainControl` control adds a button to turn terrain on and off
840
- * by triggering the terrain logic that is already deployed in the Map object.
841
- */
842
- declare class MaptilerTerrainControl implements IControl {
843
- _map: Map;
844
- _container: HTMLElement;
845
- _terrainButton: HTMLButtonElement;
846
- constructor();
847
- onAdd(map: Map): HTMLElement;
848
- onRemove(): void;
849
- _toggleTerrain(): void;
850
- _updateTerrainIcon(): void;
851
- }
852
-
853
- type HTMLButtonElementPlus = HTMLButtonElement & {
854
- clickFunction: (e?: Event) => unknown;
855
- };
856
- declare class MaptilerNavigationControl extends NavigationControl {
857
- constructor();
858
- /**
859
- * Overloading: the button now stores its click callback so that we can later on delete it and replace it
860
- */
861
- _createButton(className: string, fn: (e?: Event) => unknown): HTMLButtonElementPlus;
862
- /**
863
- * Overloading: Limit how flat the compass icon can get
864
- */
865
- _rotateCompassArrow: () => void;
866
- }
867
-
868
- interface Link {
869
- href: string | null;
870
- }
871
- interface XMLProperties {
872
- links?: Link[];
873
- }
874
- interface PlacemarkProperties {
875
- name?: string;
876
- address?: string;
877
- styleUrl?: string;
878
- description?: string;
879
- styleHash?: string;
880
- styleMapHash?: Record<string, string | null>;
881
- timespan?: {
882
- begin: string;
883
- end: string;
884
- };
885
- timestamp?: string;
886
- stroke?: string;
887
- "stroke-opacity"?: number;
888
- "stroke-width"?: number;
889
- fill?: string;
890
- "fill-opacity"?: number;
891
- visibility?: string;
892
- icon?: string;
893
- coordTimes?: (string | null)[] | (string | null)[][];
894
- }
895
- /**
896
- * create a function that converts a string to XML
897
- * https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
898
- */
899
- declare function str2xml(str: string): Document;
900
- /**
901
- * Check one of the top level child node is of a given type ("gpx", "kml").
902
- * The check is not case sensitive.
903
- * @param doc
904
- * @param nodeName
905
- * @returns
906
- */
907
- declare function hasChildNodeWithName(doc: Document, nodeName: string): boolean;
908
- /**
909
- * create a function that converts a XML to a string
910
- * https://developer.mozilla.org/en-US/docs/Web/API/XMLSerializer
911
- */
912
- declare function xml2str(node: Node): string;
913
- /**
914
- * Given a XML document using the GPX spec, return GeoJSON
915
- */
916
- declare function gpx(doc: string | Document): GeoJSON.FeatureCollection;
917
- /**
918
- * Given a XML document using the KML spec, return GeoJSON
919
- */
920
- declare function kml(doc: string | Document, xml2string?: (node: Node) => string): GeoJSON.FeatureCollection;
921
- declare function gpxOrKml(doc: string | Document): GeoJSON.FeatureCollection | null;
922
-
923
- type RgbaColor = [number, number, number] | [number, number, number, number];
924
- type ColorStop = {
925
- /**
926
- * The "value" at which this ColorStop should be applied.
927
- */
928
- value: number;
929
- /**
930
- * RGB[A] - Array of 3-4 numbers. 0-255 per channel.
931
- */
932
- color: RgbaColor;
933
- };
934
- /**
935
- * A RGBA color as per the array definition
936
- */
937
- type ArrayColor = [number, number, number, number];
938
- /**
939
- * A color ramp stop as per array definition
940
- */
941
- type ArrayColorRampStop = [
942
- /**
943
- * Real world value in a real world unit
944
- */
945
- number,
946
- /**
947
- * Color RGBA
948
- */
949
- ArrayColor
950
- ];
951
- /**
952
- * A color ramp as per array definition
953
- */
954
- type ArrayColorRamp = Array<ArrayColorRampStop>;
955
- type ColorRampOptions = {
956
- /**
957
- * The value the colorramp starts
958
- */
959
- min?: number;
960
- /**
961
- * The value the colorramp ends
962
- */
963
- max?: number;
964
- /**
965
- * Some color stops to copy from
966
- */
967
- stops?: Array<ColorStop>;
968
- };
969
- declare class ColorRamp extends Array<ColorStop> {
970
- /**
971
- * Converts a array-definition color ramp definition into a usable ColorRamp instance.
972
- * Note: units are not converted and may need to to be converted beforehand (eg. kelvin to centigrade)
973
- * @param cr
974
- * @returns
975
- */
976
- static fromArrayDefinition(cr: ArrayColorRamp): ColorRamp;
977
- private min;
978
- private max;
979
- constructor(options?: ColorRampOptions);
980
- setStops(stops: Array<ColorStop>, options?: {
981
- clone?: boolean;
982
- }): ColorRamp;
983
- scale(min: number, max: number, options?: {
984
- clone?: boolean;
985
- }): ColorRamp;
986
- at(pos: number): ColorStop;
987
- clone(): ColorRamp;
988
- getRawColorStops(): Array<ColorStop>;
989
- reverse(options?: {
990
- clone?: boolean;
991
- }): ColorRamp;
992
- getBounds(): {
993
- min: number;
994
- max: number;
995
- };
996
- getColor(value: number, options?: {
997
- smooth?: boolean;
998
- }): RgbaColor;
999
- /**
1000
- * Get the color as an hexadecimal string
1001
- */
1002
- getColorHex(value: number, options?: {
1003
- smooth?: boolean;
1004
- withAlpha?: boolean;
1005
- }): string;
1006
- /**
1007
- * Get the color of the color ramp at a relative position in [0, 1]
1008
- */
1009
- getColorRelative(value: number, options?: {
1010
- smooth?: boolean;
1011
- }): RgbaColor;
1012
- getCanvasStrip(options?: {
1013
- horizontal?: boolean;
1014
- size?: number;
1015
- smooth?: boolean;
1016
- }): HTMLCanvasElement;
1017
- /**
1018
- * Apply a non-linear ressampling. This will create a new instance of ColorRamp with the same bounds.
1019
- */
1020
- resample(method: "ease-in-square" | "ease-out-square" | "ease-in-sqrt" | "ease-out-sqrt" | "ease-in-exp" | "ease-out-exp", samples?: number): ColorRamp;
1021
- /**
1022
- * Makes a clone of this color ramp that is fully transparant at the begining of their range
1023
- */
1024
- transparentStart(): ColorRamp;
1025
- /**
1026
- * Check if this color ramp has a transparent start
1027
- */
1028
- hasTransparentStart(): boolean;
1029
- }
1030
- /**
1031
- * This is a collection of built-in color ramps. They are all defined in the range [0, 1]
1032
- * but can be scaled or reversed to fit specific usages.
1033
- */
1034
- declare const ColorRampCollection: {
1035
- /**
1036
- * A fully transparent [0, 0, 0, 0] colorramp to hide data.
1037
- * Defined in interval [0, 1], without unit.
1038
- */
1039
- NULL: ColorRamp;
1040
- GRAY: ColorRamp;
1041
- /**
1042
- * Classic jet color ramp.
1043
- * Defined in interval [0, 1], without unit.
1044
- */
1045
- JET: ColorRamp;
1046
- /**
1047
- * Classic HSV color ramp (hue, saturation, value).
1048
- * Defined in interval [0, 1], without unit.
1049
- */
1050
- HSV: ColorRamp;
1051
- /**
1052
- * Classic hot color ramp.
1053
- * Defined in interval [0, 1], without unit.
1054
- */
1055
- HOT: ColorRamp;
1056
- /**
1057
- * Classic spring color ramp.
1058
- * Defined in interval [0, 1], without unit.
1059
- */
1060
- SPRING: ColorRamp;
1061
- /**
1062
- * Classic summer color ramp.
1063
- * Defined in interval [0, 1], without unit.
1064
- */
1065
- SUMMER: ColorRamp;
1066
- /**
1067
- * Classic autommn color ramp.
1068
- * Defined in interval [0, 1], without unit.
1069
- */
1070
- AUTOMN: ColorRamp;
1071
- /**
1072
- * Classic winter color ramp.
1073
- * Defined in interval [0, 1], without unit.
1074
- */
1075
- WINTER: ColorRamp;
1076
- /**
1077
- * Classic bone color ramp.
1078
- * Defined in interval [0, 1], without unit.
1079
- */
1080
- BONE: ColorRamp;
1081
- /**
1082
- * Classic copper color ramp.
1083
- * Defined in interval [0, 1], without unit.
1084
- */
1085
- COPPER: ColorRamp;
1086
- /**
1087
- * Classic greys color ramp.
1088
- * Defined in interval [0, 1], without unit.
1089
- */
1090
- GREYS: ColorRamp;
1091
- /**
1092
- * Classic yignbu color ramp (blue to light yellow).
1093
- * Defined in interval [0, 1], without unit.
1094
- */
1095
- YIGNBU: ColorRamp;
1096
- /**
1097
- * Classic greens color ramp.
1098
- * Defined in interval [0, 1], without unit.
1099
- */
1100
- GREENS: ColorRamp;
1101
- /**
1102
- * Classic yiorrd color ramp (red to light yellow).
1103
- * Defined in interval [0, 1], without unit.
1104
- */
1105
- YIORRD: ColorRamp;
1106
- /**
1107
- * Classic blue-red color ramp.
1108
- * Defined in interval [0, 1], without unit.
1109
- */
1110
- BLUERED: ColorRamp;
1111
- /**
1112
- * Classic rdbu color ramp.
1113
- * Defined in interval [0, 1], without unit.
1114
- */
1115
- RDBU: ColorRamp;
1116
- /**
1117
- * Classic picnic color ramp.
1118
- * Defined in interval [0, 1], without unit.
1119
- */
1120
- PICNIC: ColorRamp;
1121
- /**
1122
- * Classic rainbow color ramp.
1123
- * Defined in interval [0, 1], without unit.
1124
- */
1125
- RAINBOW: ColorRamp;
1126
- /**
1127
- * Classic Portland color ramp.
1128
- * Defined in interval [0, 1], without unit.
1129
- */
1130
- PORTLAND: ColorRamp;
1131
- /**
1132
- * Classic blackbody color ramp.
1133
- * Defined in interval [0, 1], without unit.
1134
- */
1135
- BLACKBODY: ColorRamp;
1136
- /**
1137
- * Classic earth color ramp.
1138
- * Defined in interval [0, 1], without unit.
1139
- */
1140
- EARTH: ColorRamp;
1141
- /**
1142
- * Classic electric color ramp.
1143
- * Defined in interval [0, 1], without unit.
1144
- */
1145
- ELECTRIC: ColorRamp;
1146
- /**
1147
- * Classic viridis color ramp.
1148
- * Defined in interval [0, 1], without unit.
1149
- */
1150
- VIRIDIS: ColorRamp;
1151
- /**
1152
- * Classic inferno color ramp.
1153
- * Defined in interval [0, 1], without unit.
1154
- */
1155
- INFERNO: ColorRamp;
1156
- /**
1157
- * Classic magma color ramp.
1158
- * Defined in interval [0, 1], without unit.
1159
- */
1160
- MAGMA: ColorRamp;
1161
- /**
1162
- * Classic plasma color ramp.
1163
- * Defined in interval [0, 1], without unit.
1164
- */
1165
- PLASMA: ColorRamp;
1166
- /**
1167
- * Classic warm color ramp.
1168
- * Defined in interval [0, 1], without unit.
1169
- */
1170
- WARM: ColorRamp;
1171
- /**
1172
- * Classic cool color ramp.
1173
- * Defined in interval [0, 1], without unit.
1174
- */
1175
- COOL: ColorRamp;
1176
- /**
1177
- * Classic rainboz soft color ramp.
1178
- * Defined in interval [0, 1], without unit.
1179
- */
1180
- RAINBOW_SOFT: ColorRamp;
1181
- /**
1182
- * Classic bathymetry color ramp.
1183
- * Defined in interval [0, 1], without unit.
1184
- */
1185
- BATHYMETRY: ColorRamp;
1186
- /**
1187
- * Classic cdom color ramp.
1188
- * Defined in interval [0, 1], without unit.
1189
- */
1190
- CDOM: ColorRamp;
1191
- /**
1192
- * Classic chlorophyll color ramp.
1193
- * Defined in interval [0, 1], without unit.
1194
- */
1195
- CHLOROPHYLL: ColorRamp;
1196
- /**
1197
- * Classic density color ramp.
1198
- * Defined in interval [0, 1], without unit.
1199
- */
1200
- DENSITY: ColorRamp;
1201
- /**
1202
- * Classic freesurface blue color ramp.
1203
- * Defined in interval [0, 1], without unit.
1204
- */
1205
- FREESURFACE_BLUE: ColorRamp;
1206
- /**
1207
- * Classic freesurface red color ramp.
1208
- * Defined in interval [0, 1], without unit.
1209
- */
1210
- FREESURFACE_RED: ColorRamp;
1211
- /**
1212
- * Classic oxygen color ramp.
1213
- * Defined in interval [0, 1], without unit.
1214
- */
1215
- OXYGEN: ColorRamp;
1216
- /**
1217
- * Classic par color ramp.
1218
- * Defined in interval [0, 1], without unit.
1219
- */
1220
- PAR: ColorRamp;
1221
- /**
1222
- * Classic phase color ramp.
1223
- * Defined in interval [0, 1], without unit.
1224
- */
1225
- PHASE: ColorRamp;
1226
- /**
1227
- * Classic salinity color ramp.
1228
- * Defined in interval [0, 1], without unit.
1229
- */
1230
- SALINITY: ColorRamp;
1231
- /**
1232
- * Classic temperature color ramp.
1233
- * Defined in interval [0, 1], without unit.
1234
- */
1235
- TEMPERATURE: ColorRamp;
1236
- /**
1237
- * Classic turbidity color ramp.
1238
- * Defined in interval [0, 1], without unit.
1239
- */
1240
- TURBIDITY: ColorRamp;
1241
- /**
1242
- * Classic velocity blue color ramp.
1243
- * Defined in interval [0, 1], without unit.
1244
- */
1245
- VELOCITY_BLUE: ColorRamp;
1246
- /**
1247
- * Classic velocity green color ramp.
1248
- * Defined in interval [0, 1], without unit.
1249
- */
1250
- VELOCITY_GREEN: ColorRamp;
1251
- /**
1252
- * Classic cube helix color ramp.
1253
- * Defined in interval [0, 1], without unit.
1254
- */
1255
- CUBEHELIX: ColorRamp;
1256
- /**
1257
- * The cividis color ramp is color blind friendly.
1258
- * Read more here https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0199239
1259
- * Defined in interval [0, 1], without unit.
1260
- */
1261
- CIVIDIS: ColorRamp;
1262
- /**
1263
- * Classic turbo color ramp.
1264
- * This is a luminance-constant alternative to the jet, making it more
1265
- * clor-blind friendly.
1266
- * Defined in interval [0, 1], without unit.
1267
- */
1268
- TURBO: ColorRamp;
1269
- /**
1270
- * The rocket color ramp is perceptually uniform, which makes it more
1271
- * color bliend friendly than the classic magma color ramp.
1272
- * Defined in interval [0, 1], without unit.
1273
- */
1274
- ROCKET: ColorRamp;
1275
- /**
1276
- * The mako color ramp is perceptually uniform and can be seen as
1277
- * a color blind friendly alternative to bathymetry or yignbu.
1278
- * Defined in interval [0, 1], without unit.
1279
- */
1280
- MAKO: ColorRamp;
1281
- };
1282
-
1283
- /**
1284
- * Array of string values that depend on zoom level
1285
- */
1286
- type ZoomStringValues = Array<{
1287
- /**
1288
- * Zoom level
1289
- */
1290
- zoom: number;
1291
- /**
1292
- * Value for the given zoom level
1293
- */
1294
- value: string;
1295
- }>;
1296
- /**
1297
- *
1298
- * Array of number values that depend on zoom level
1299
- */
1300
- type ZoomNumberValues = Array<{
1301
- /**
1302
- * Zoom level
1303
- */
1304
- zoom: number;
1305
- /**
1306
- * Value for the given zoom level
1307
- */
1308
- value: number;
1309
- }>;
1310
- type PropertyValues = Array<{
1311
- /**
1312
- * Value of the property (input)
1313
- */
1314
- propertyValue: number;
1315
- /**
1316
- * Value to associate it with (output)
1317
- */
1318
- value: number;
1319
- }>;
1320
- type CommonShapeLayerOptions = {
1321
- /**
1322
- * ID to give to the layer.
1323
- * If not provided, an auto-generated ID of the for "maptiler-layer-xxxxxx" will be auto-generated,
1324
- * with "xxxxxx" being a random string.
1325
- */
1326
- layerId?: string;
1327
- /**
1328
- * ID to give to the geojson source.
1329
- * If not provided, an auto-generated ID of the for "maptiler-source-xxxxxx" will be auto-generated,
1330
- * with "xxxxxx" being a random string.
1331
- */
1332
- sourceId?: string;
1333
- /**
1334
- * A geojson Feature collection or a URL to a geojson or the UUID of a MapTiler Cloud dataset.
1335
- */
1336
- data: FeatureCollection | string;
1337
- /**
1338
- * The ID of an existing layer to insert the new layer before, resulting in the new layer appearing
1339
- * visually beneath the existing layer. If this argument is not specified, the layer will be appended
1340
- * to the end of the layers array and appear visually above all other layers.
1341
- */
1342
- beforeId?: string;
1343
- /**
1344
- * Zoom level at which it starts to show.
1345
- * Default: `0`
1346
- */
1347
- minzoom?: number;
1348
- /**
1349
- * Zoom level after which it no longer show.
1350
- * Default: `22`
1351
- */
1352
- maxzoom?: number;
1353
- /**
1354
- * Whether or not to add an outline.
1355
- * Default: `false`
1356
- */
1357
- outline?: boolean;
1358
- /**
1359
- * Color of the outline. This is can be a constant color string or a definition based on zoom levels.
1360
- * Applies only if `.outline` is `true`.
1361
- * Default: `white`
1362
- */
1363
- outlineColor?: string | ZoomStringValues;
1364
- /**
1365
- * Width of the outline (relative to screen-space). This is can be a constant width or a definition based on zoom levels.
1366
- * Applies only if `.outline` is `true`.
1367
- * Default: `1`
1368
- */
1369
- outlineWidth?: number | ZoomNumberValues;
1370
- /**
1371
- * Opacity of the outline. This is can be a constant opacity in [0, 1] or a definition based on zoom levels
1372
- * Applies only if `.outline` is `true`.
1373
- * Default: `1`
1374
- */
1375
- outlineOpacity?: number | ZoomNumberValues;
1376
- };
1377
- type PolylineLayerOptions = CommonShapeLayerOptions & {
1378
- /**
1379
- * Color of the line (or polyline). This is can be a constant color string or a definition based on zoom levels.
1380
- * Default: a color randomly pick from a list
1381
- */
1382
- lineColor?: string | ZoomStringValues;
1383
- /**
1384
- * Width of the line (relative to screen-space). This is can be a constant width or a definition based on zoom levels
1385
- * Default: `3`
1386
- */
1387
- lineWidth?: number | ZoomNumberValues;
1388
- /**
1389
- * Opacity of the line. This is can be a constant opacity in [0, 1] or a definition based on zoom levels.
1390
- * Default: `1`
1391
- */
1392
- lineOpacity?: number | ZoomNumberValues;
1393
- /**
1394
- * How blury the line is, with `0` being no blur and `10` and beyond being quite blurry.
1395
- * Default: `0`
1396
- */
1397
- lineBlur?: number | ZoomNumberValues;
1398
- /**
1399
- * Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.
1400
- * Default: `0`
1401
- */
1402
- lineGapWidth?: number | ZoomNumberValues;
1403
- /**
1404
- * Sequence of line and void to create a dash pattern. The unit is the line width so that
1405
- * a dash array value of `[3, 1]` will create a segment worth 3 times the width of the line,
1406
- * followed by a spacing worth 1 time the line width, and then repeat.
1407
- *
1408
- * Alternatively, this property can be a string made of underscore and whitespace characters
1409
- * such as `"___ _ "` and internaly this will be translated into [3, 1, 1, 1]. Note that
1410
- * this way of describing dash arrays with a string only works for integer values.
1411
- *
1412
- * Dash arrays can contain more than 2 element to create more complex patters. For instance
1413
- * a dash array value of [3, 2, 1, 2] will create the following sequence:
1414
- * - a segment worth 3 times the width
1415
- * - a spacing worth 2 times the width
1416
- * - a segment worth 1 times the width
1417
- * - a spacing worth 2 times the width
1418
- * - repeat
1419
- *
1420
- * Default: no dash pattern
1421
- */
1422
- lineDashArray?: Array<number> | string;
1423
- /**
1424
- * The display of line endings for both the line and the outline (if `.outline` is `true`)
1425
- * - "butt": A cap with a squared-off end which is drawn to the exact endpoint of the line.
1426
- * - "round": A cap with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line.
1427
- * - "square": A cap with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width.
1428
- * Default: "round"
1429
- */
1430
- lineCap?: "butt" | "round" | "square";
1431
- /**
1432
- * The display of lines when joining for both the line and the outline (if `.outline` is `true`)
1433
- * - "bevel": A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width.
1434
- * - "round": A join with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line.
1435
- * - "miter": A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet.
1436
- * Default: "round"
1437
- */
1438
- lineJoin?: "bevel" | "round" | "miter";
1439
- /**
1440
- * How blury the outline is, with `0` being no blur and `10` and beyond being quite blurry.
1441
- * Applies only if `.outline` is `true`.
1442
- * Default: `0`
1443
- */
1444
- outlineBlur?: number | ZoomNumberValues;
1445
- };
1446
- type PolygonLayerOptions = CommonShapeLayerOptions & {
1447
- /**
1448
- * Color of the polygon. This is can be a constant color string or a definition based on zoom levels.
1449
- * Default: a color randomly pick from a list
1450
- */
1451
- fillColor?: string | ZoomStringValues;
1452
- /**
1453
- * Opacity of the polygon. This is can be a constant opacity in [0, 1] or a definition based on zoom levels
1454
- * Default: `1`
1455
- */
1456
- fillOpacity?: ZoomNumberValues;
1457
- /**
1458
- * Position of the outline with regard to the polygon edge (when `.outline` is `true`)
1459
- * Default: `"center"`
1460
- */
1461
- outlinePosition: "center" | "inside" | "outside";
1462
- /**
1463
- * Sequence of line and void to create a dash pattern. The unit is the line width so that
1464
- * a dash array value of `[3, 1]` will create a segment worth 3 times the width of the line,
1465
- * followed by a spacing worth 1 time the line width, and then repeat.
1466
- *
1467
- * Alternatively, this property can be a string made of underscore and whitespace characters
1468
- * such as `"___ _ "` and internaly this will be translated into [3, 1, 1, 1]. Note that
1469
- * this way of describing dash arrays with a string only works for integer values.
1470
- *
1471
- * Dash arrays can contain more than 2 element to create more complex patters. For instance
1472
- * a dash array value of [3, 2, 1, 2] will create the following sequence:
1473
- * - a segment worth 3 times the width
1474
- * - a spacing worth 2 times the width
1475
- * - a segment worth 1 times the width
1476
- * - a spacing worth 2 times the width
1477
- * - repeat
1478
- *
1479
- * Default: no dash pattern
1480
- */
1481
- outlineDashArray?: Array<number> | string;
1482
- /**
1483
- * The display of line endings for both the line and the outline (if `.outline` is `true`)
1484
- * - "butt": A cap with a squared-off end which is drawn to the exact endpoint of the line.
1485
- * - "round": A cap with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line.
1486
- * - "square": A cap with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width.
1487
- * Default: "round"
1488
- */
1489
- outlineCap?: "butt" | "round" | "square";
1490
- /**
1491
- * The display of lines when joining for both the line and the outline (if `.outline` is `true`)
1492
- * - "bevel": A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width.
1493
- * - "round": A join with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line.
1494
- * - "miter": A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet.
1495
- * Default: "round"
1496
- */
1497
- outlineJoin?: "bevel" | "round" | "miter";
1498
- /**
1499
- * The pattern is an image URL to be put as a repeated background pattern of the polygon.
1500
- * Default: `null` (no pattern, `fillColor` will be used)
1501
- */
1502
- pattern?: string | null;
1503
- /**
1504
- * How blury the outline is, with `0` being no blur and `10` and beyond being quite blurry.
1505
- * Applies only if `.outline` is `true`.
1506
- * Default: `0`
1507
- */
1508
- outlineBlur?: number | ZoomNumberValues;
1509
- };
1510
- type PointLayerOptions = CommonShapeLayerOptions & {
1511
- /**
1512
- * Can be a unique point color as a string (CSS color such as "#FF0000" or "red").
1513
- * Alternatively, the color can be a ColorRamp with a range.
1514
- * In case of `.cluster` being `true`, the range of the ColorRamp will be addressed with the number of elements in
1515
- * the cluster. If `.cluster` is `false`, the color will be addressed using the value of the `.property`.
1516
- * If no `.property` is given but `.pointColor` is a ColorRamp, the chosen color is the one at the lower bound of the ColorRamp.
1517
- * Default: a color randomly pick from a list
1518
- */
1519
- pointColor?: string | ColorRamp;
1520
- /**
1521
- * Radius of the points. Can be a fixed size or a value dependant on the zoom.
1522
- * If `.pointRadius` is not provided, the radius will depend on the size of each cluster (if `.cluster` is `true`)
1523
- * or on the value of each point (if `.property` is provided and `.pointColor` is a ColorRamp).
1524
- * The radius will be between `.minPointRadius` and `.maxPointRadius`
1525
- */
1526
- pointRadius?: number | ZoomNumberValues;
1527
- /**
1528
- * The minimum point radius posible.
1529
- * Default: `10`
1530
- */
1531
- minPointRadius?: number;
1532
- /**
1533
- * The maximum point radius posible.
1534
- * Default: `40`
1535
- */
1536
- maxPointRadius?: number;
1537
- /**
1538
- * The point property to observe and apply the radius and color upon.
1539
- * This is ignored if `.cluster` is `true` as the observed value will be fiorced to being the number
1540
- * of elements in each cluster.
1541
- *
1542
- * Default: none
1543
- */
1544
- property?: string;
1545
- /**
1546
- * Opacity of the point or icon. This is can be a constant opacity in [0, 1] or a definition based on zoom levels.
1547
- * Alternatively, if not provided but the `.pointColor` is a ColorRamp, the opacity will be extracted from tha alpha
1548
- * component if present.
1549
- * Default: `1`
1550
- */
1551
- pointOpacity?: number | ZoomNumberValues;
1552
- /**
1553
- * If `true`, the points will keep their circular shape align with the wiewport.
1554
- * If `false`, the points will be like flatten on the map. This difference shows
1555
- * when the map is tilted.
1556
- * Default: `true`
1557
- */
1558
- alignOnViewport?: boolean;
1559
- /**
1560
- * Whether the points should cluster
1561
- */
1562
- cluster?: boolean;
1563
- /**
1564
- * Shows a label with the numerical value id `true`.
1565
- * If `.cluster` is `true`, the value will be the numebr of elements in the cluster.
1566
- *
1567
- *
1568
- * Default: `true` if `cluster` or `dataDrivenStyleProperty` are used, `false` otherwise.
1569
- */
1570
- showLabel?: boolean;
1571
- /**
1572
- * text color used for the number elements in each cluster.
1573
- * Applicable only when `cluster` is `true`.
1574
- * Default: `#000000` (black)
1575
- */
1576
- labelColor?: string;
1577
- /**
1578
- * text size used for the number elements in each cluster.
1579
- * Applicable only when `cluster` is `true`.
1580
- * Default: `12`
1581
- */
1582
- labelSize?: number;
1583
- /**
1584
- * Only if `.cluster` is `false`.
1585
- * If the radius is driven by a property, then it will also scale by zoomming if `.zoomCompensation` is `true`.
1586
- * If `false`, the radius will not adapt according to the zoom level.
1587
- * Default: `true`
1588
- */
1589
- zoomCompensation?: boolean;
1590
- };
1591
- type HeatmapLayerOptions = {
1592
- /**
1593
- * ID to give to the layer.
1594
- * If not provided, an auto-generated ID of the for "maptiler-layer-xxxxxx" will be auto-generated,
1595
- * with "xxxxxx" being a random string.
1596
- */
1597
- layerId?: string;
1598
- /**
1599
- * ID to give to the geojson source.
1600
- * If not provided, an auto-generated ID of the for "maptiler-source-xxxxxx" will be auto-generated,
1601
- * with "xxxxxx" being a random string.
1602
- */
1603
- sourceId?: string;
1604
- /**
1605
- * A geojson Feature collection or a URL to a geojson or the UUID of a MapTiler Cloud dataset.
1606
- */
1607
- data: FeatureCollection | string;
1608
- /**
1609
- * The ID of an existing layer to insert the new layer before, resulting in the new layer appearing
1610
- * visually beneath the existing layer. If this argument is not specified, the layer will be appended
1611
- * to the end of the layers array and appear visually above all other layers.
1612
- */
1613
- beforeId?: string;
1614
- /**
1615
- * Zoom level at which it starts to show.
1616
- * Default: `0`
1617
- */
1618
- minzoom?: number;
1619
- /**
1620
- * Zoom level after which it no longer show.
1621
- * Default: `22`
1622
- */
1623
- maxzoom?: number;
1624
- /**
1625
- * The ColorRamp instance to use for visualization. The color ramp is expected to be defined in the
1626
- * range `[0, 1]` or else will be forced to this range.
1627
- * Default: `ColorRampCollection.TURBO`
1628
- */
1629
- colorRamp?: ColorRamp;
1630
- /**
1631
- * Use a property to apply a weight to each data point. Using a property requires also using
1632
- * the options `.propertyValueWeight` or otherwise will be ignored.
1633
- * Default: none, the points will all have a weight of `1`.
1634
- */
1635
- property?: string;
1636
- /**
1637
- * The weight to give to each data point. If of type `PropertyValueWeights`, then the options `.property`
1638
- * must also be provided. If used a number, all data points will be weighted by the same number (which is of little interest)
1639
- */
1640
- weight?: PropertyValues | number;
1641
- /**
1642
- * The radius (in screenspace) can be:
1643
- * - a fixed number that will be constant across zoom level
1644
- * - of type `ZoomNumberValues` to be ramped accoding to zoom level (`.zoomCompensation` will then be ignored)
1645
- * - of type `PropertyValues` to be driven by the value of a property.
1646
- * If so, the option `.property` must be provided and will still be resized according to zoom level,
1647
- * unless the option `.zoomCompensation` is set to `false`.
1648
- *
1649
- * Default:
1650
- */
1651
- radius?: number | ZoomNumberValues | PropertyValues;
1652
- /**
1653
- * The opacity can be a fixed value or zoom-driven.
1654
- * Default: fades-in 0.25z after minzoom and fade-out 0.25z before maxzoom
1655
- */
1656
- opacity?: number | ZoomNumberValues;
1657
- /**
1658
- * The intensity is zoom-dependent. By default, the intensity is going to be scaled by zoom to preserve
1659
- * a natural aspect or the data distribution.
1660
- */
1661
- intensity?: number | ZoomNumberValues;
1662
- /**
1663
- * If the radius is driven by a property, then it will also scale by zoomming if `.zoomCompensation` is `true`.
1664
- * If `false`, the radius will not adapt according to the zoom level.
1665
- * Default: `true`
1666
- */
1667
- zoomCompensation?: boolean;
1668
- };
1669
- /**
1670
- * Add a polyline to the map from various sources and with builtin styling.
1671
- * Compatible sources:
1672
- * - gpx content as string
1673
- * - gpx file from URL
1674
- * - kml content from string
1675
- * - kml from url
1676
- * - geojson from url
1677
- * - geojson content as string
1678
- * - geojson content as JS object
1679
- * - uuid of a MapTiler Cloud dataset
1680
- *
1681
- * The method also gives the possibility to add an outline layer (if `options.outline` is `true`)
1682
- * and if so , the returned property `polylineOutlineLayerId` will be a string. As a result, two layers
1683
- * would be added.
1684
- *
1685
- * The default styling creates a line layer of constant width of 3px, the color will be randomly picked
1686
- * from a curated list of colors and the opacity will be 1.
1687
- * If the outline is enabled, the outline width is of 1px at all zoom levels, the color is white and
1688
- * the opacity is 1.
1689
- *
1690
- * Those style properties can be changed and ramped according to zoom level using an easier syntax.
1691
- *
1692
- */
1693
- declare function addPolyline(
1694
- /**
1695
- * Map instance to add a polyline layer to
1696
- */
1697
- map: Map,
1698
- /**
1699
- * Options related to adding a polyline layer
1700
- */
1701
- options: PolylineLayerOptions,
1702
- /**
1703
- * When the polyline data is loaded from a distant source, these options are propagated to the call of `fetch`
1704
- */
1705
- fetchOptions?: RequestInit): Promise<{
1706
- polylineLayerId: string;
1707
- polylineOutlineLayerId: string;
1708
- polylineSourceId: string;
1709
- }>;
1710
- /**
1711
- * Add a polygon with styling options.
1712
- */
1713
- declare function addPolygon(map: Map, options: PolygonLayerOptions): {
1714
- /**
1715
- * ID of the fill layer
1716
- */
1717
- polygonLayerId: string;
1718
- /**
1719
- * ID of the outline layer (will be `""` if no outline)
1720
- */
1721
- polygonOutlineLayerId: string;
1722
- /**
1723
- * ID of the source that contains the data
1724
- */
1725
- polygonSourceId: string;
1726
- };
1727
- /**
1728
- * Add a point layer from a GeoJSON source (or an existing sourceId) with many styling options
1729
- */
1730
- declare function addPoint(
1731
- /**
1732
- * The Map instance to add a point layer to
1733
- */
1734
- map: Map, options: PointLayerOptions): {
1735
- /**
1736
- * ID of the unclustered point layer
1737
- */
1738
- pointLayerId: string;
1739
- /**
1740
- * ID of the clustered point layer (empty if `cluster` options id `false`)
1741
- */
1742
- clusterLayerId: string;
1743
- /**
1744
- * ID of the layer that shows the count of elements in each cluster (empty if `cluster` options id `false`)
1745
- */
1746
- labelLayerId: string;
1747
- /**
1748
- * ID of the data source
1749
- */
1750
- pointSourceId: string;
1751
- };
1752
- /**
1753
- * Add a polyline witgh optional outline from a GeoJSON object
1754
- */
1755
- declare function addHeatmap(
1756
- /**
1757
- * Map instance to add a heatmap layer to
1758
- */
1759
- map: Map, options: HeatmapLayerOptions): {
1760
- /**
1761
- * ID of the heatmap layer
1762
- */
1763
- heatmapLayerId: string;
1764
- /**
1765
- * ID of the data source
1766
- */
1767
- heatmapSourceId: string;
1768
- };
1769
-
1770
- /**
1771
- * Helpers are a set of functions to facilitate the creation of sources and layers
1772
- */
1773
- declare const helpers: {
1774
- addPolyline: typeof addPolyline;
1775
- addPolygon: typeof addPolygon;
1776
- addPoint: typeof addPoint;
1777
- addHeatmap: typeof addHeatmap;
1778
- };
1779
-
1780
- /**
1781
- * Get the version of MapTiler SDK
1782
- */
1783
- declare function getVersion(): string;
1784
-
1785
- export { type ArrayColor, type ArrayColorRamp, type ArrayColorRampStop, AttributionControl, BoxZoomHandler, CanvasSource, ColorRamp, ColorRampCollection, type ColorRampOptions, type ColorStop, type CommonShapeLayerOptions, CooperativeGesturesHandler, FullscreenControl, GeoJSONSource, GeolocateControl, GeolocationType, type HeatmapLayerOptions, ImageSource, KeyboardHandler, Language, type LanguageKey, type LanguageString, type Link, type LoadWithTerrainEvent, LogoControl, Map, MapMouseEvent, type MapOptions, MapTouchEvent, MapWheelEvent, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerNavigationControl, MaptilerTerrainControl, Marker, type MinimapOptions, type MinimapOptionsInput, NavigationControl, type ParentRect, type PlacemarkProperties, type PointLayerOptions, type PolygonLayerOptions, type PolylineLayerOptions, Popup, type PropertyValues, RasterDEMTileSource, RasterTileSource, type RgbaColor, ScaleControl, ScrollZoomHandler, SdkConfig, Style, TerrainControl, TwoFingersTouchPitchHandler, type Unit, VectorTileSource, VideoSource, type XMLProperties, type ZoomNumberValues, type ZoomStringValues, config, getBrowserLanguage, getVersion, gpx, gpxOrKml, hasChildNodeWithName, helpers, isLanguageSupported, kml, str2xml, xml2str };
1
+ export * from './src/index'