@maptiler/sdk 1.1.2 → 1.2.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.
- package/.eslintrc.cjs +15 -5
- package/.github/pull_request_template.md +11 -0
- package/.github/workflows/format-lint.yml +24 -0
- package/CHANGELOG.md +94 -51
- package/colorramp.md +93 -0
- package/dist/maptiler-sdk.d.ts +1207 -123
- package/dist/maptiler-sdk.min.mjs +3 -1
- package/dist/maptiler-sdk.mjs +3561 -485
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/maptiler-sdk.umd.js +3825 -869
- package/dist/maptiler-sdk.umd.js.map +1 -1
- package/dist/maptiler-sdk.umd.min.js +51 -49
- package/package.json +27 -13
- package/readme.md +298 -0
- package/rollup.config.js +2 -16
- package/src/Map.ts +489 -357
- package/src/MaptilerGeolocateControl.ts +23 -20
- package/src/MaptilerLogoControl.ts +3 -3
- package/src/MaptilerNavigationControl.ts +9 -6
- package/src/MaptilerTerrainControl.ts +15 -14
- package/src/Minimap.ts +373 -0
- package/src/Point.ts +3 -5
- package/src/colorramp.ts +1216 -0
- package/src/config.ts +4 -3
- package/src/converters/index.ts +1 -0
- package/src/converters/xml.ts +681 -0
- package/src/defaults.ts +1 -1
- package/src/helpers/index.ts +27 -0
- package/src/helpers/stylehelper.ts +395 -0
- package/src/helpers/vectorlayerhelpers.ts +1511 -0
- package/src/index.ts +10 -0
- package/src/language.ts +116 -79
- package/src/mapstyle.ts +4 -2
- package/src/tools.ts +68 -16
- package/tsconfig.json +8 -5
- package/vite.config.ts +10 -0
- package/demos/maptiler-sdk.css +0 -147
- package/demos/maptiler-sdk.umd.js +0 -4041
- package/demos/mountain.html +0 -67
- package/demos/simple.html +0 -67
- package/demos/transform-request.html +0 -81
package/dist/maptiler-sdk.d.ts
CHANGED
|
@@ -1,14 +1,36 @@
|
|
|
1
1
|
import * as maplibre_gl from 'maplibre-gl';
|
|
2
|
-
import maplibre_gl__default, { MapOptions as MapOptions$1,
|
|
2
|
+
import maplibre_gl__default, { StyleSpecification, ControlPosition, LineLayerSpecification, FillLayerSpecification, MapOptions as MapOptions$1, StyleSwapOptions, StyleOptions, LayerSpecification, SourceSpecification, CustomLayerInterface, FilterSpecification, StyleSetterOptions, RequestTransformFunction, Map as Map$1, LogoOptions as LogoOptions$1, IControl } from 'maplibre-gl';
|
|
3
3
|
export * from 'maplibre-gl';
|
|
4
4
|
import { FetchFunction, ReferenceMapStyle, MapStyleVariant } from '@maptiler/client';
|
|
5
5
|
export { AutomaticStaticMapOptions, BBox, BoundedStaticMapOptions, CenteredStaticMapOptions, CoordinatesSearchOptions, GeocodingOptions, LanguageGeocoding, LanguageGeocodingString, MapStyle, MapStyleType, MapStyleVariant, Position, ReferenceMapStyle, ServiceError, coordinates, data, geocoding, geolocation, staticMaps } from '@maptiler/client';
|
|
6
6
|
import EventEmitter from 'events';
|
|
7
|
+
import { FeatureCollection } from 'geojson';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Languages. Note that not all the languages of this list are available but the compatibility list may be expanded in the future.
|
|
10
11
|
*/
|
|
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";
|
|
12
34
|
/**
|
|
13
35
|
* AUTO mode uses the language of the browser
|
|
14
36
|
*/
|
|
@@ -22,85 +44,97 @@ declare const Language: {
|
|
|
22
44
|
/**
|
|
23
45
|
* Default fallback languages that uses latin charaters
|
|
24
46
|
*/
|
|
25
|
-
readonly LATIN: "latin";
|
|
47
|
+
readonly LATIN: "name:latin";
|
|
26
48
|
/**
|
|
27
49
|
* Default fallback languages that uses non-latin charaters
|
|
28
50
|
*/
|
|
29
|
-
readonly NON_LATIN: "nonlatin";
|
|
51
|
+
readonly NON_LATIN: "name:nonlatin";
|
|
30
52
|
/**
|
|
31
53
|
* Labels are in their local language, when available
|
|
32
54
|
*/
|
|
33
|
-
readonly LOCAL: "";
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
readonly
|
|
38
|
-
readonly
|
|
39
|
-
readonly
|
|
40
|
-
readonly
|
|
41
|
-
readonly
|
|
42
|
-
readonly
|
|
43
|
-
readonly
|
|
44
|
-
readonly
|
|
45
|
-
readonly
|
|
46
|
-
readonly
|
|
47
|
-
readonly
|
|
48
|
-
readonly
|
|
49
|
-
readonly
|
|
50
|
-
readonly
|
|
51
|
-
readonly
|
|
52
|
-
readonly
|
|
53
|
-
readonly
|
|
54
|
-
readonly
|
|
55
|
-
readonly
|
|
56
|
-
readonly
|
|
57
|
-
readonly
|
|
58
|
-
readonly
|
|
59
|
-
readonly
|
|
60
|
-
readonly
|
|
61
|
-
readonly
|
|
62
|
-
readonly
|
|
63
|
-
readonly
|
|
64
|
-
readonly
|
|
65
|
-
readonly
|
|
66
|
-
readonly
|
|
67
|
-
readonly
|
|
68
|
-
readonly
|
|
69
|
-
readonly
|
|
70
|
-
readonly
|
|
71
|
-
readonly
|
|
72
|
-
readonly
|
|
73
|
-
readonly
|
|
74
|
-
readonly
|
|
75
|
-
readonly
|
|
76
|
-
readonly
|
|
77
|
-
readonly
|
|
78
|
-
readonly
|
|
79
|
-
readonly
|
|
80
|
-
readonly
|
|
81
|
-
readonly
|
|
82
|
-
readonly
|
|
83
|
-
readonly
|
|
84
|
-
readonly
|
|
85
|
-
readonly
|
|
86
|
-
readonly
|
|
87
|
-
readonly
|
|
88
|
-
readonly
|
|
89
|
-
readonly
|
|
90
|
-
readonly
|
|
91
|
-
readonly
|
|
92
|
-
readonly
|
|
93
|
-
readonly
|
|
94
|
-
readonly
|
|
95
|
-
readonly
|
|
96
|
-
readonly
|
|
97
|
-
readonly
|
|
98
|
-
readonly
|
|
99
|
-
readonly
|
|
100
|
-
readonly
|
|
101
|
-
readonly
|
|
102
|
-
readonly
|
|
103
|
-
readonly
|
|
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";
|
|
104
138
|
};
|
|
105
139
|
/**
|
|
106
140
|
* Type representing the key of the Language object
|
|
@@ -121,12 +155,12 @@ declare class SdkConfig extends EventEmitter {
|
|
|
121
155
|
/**
|
|
122
156
|
* The primary language. By default, the language of the web browser is used.
|
|
123
157
|
*/
|
|
124
|
-
primaryLanguage: LanguageString
|
|
158
|
+
primaryLanguage: LanguageString;
|
|
125
159
|
/**
|
|
126
160
|
* The secondary language, to overwrite the default language defined in the map style.
|
|
127
161
|
* This settings is highly dependant on the style compatibility and may not work in most cases.
|
|
128
162
|
*/
|
|
129
|
-
secondaryLanguage
|
|
163
|
+
secondaryLanguage?: LanguageString;
|
|
130
164
|
/**
|
|
131
165
|
* Setting on whether of not the SDK runs with a session logic.
|
|
132
166
|
* A "session" is started at the initialization of the SDK and finished when the browser
|
|
@@ -171,6 +205,41 @@ declare class SdkConfig extends EventEmitter {
|
|
|
171
205
|
}
|
|
172
206
|
declare const config: SdkConfig;
|
|
173
207
|
|
|
208
|
+
/**
|
|
209
|
+
* This is an extension adds support for adding a minimap to one of the map's control containers.
|
|
210
|
+
*/
|
|
211
|
+
|
|
212
|
+
interface ParentRect {
|
|
213
|
+
lineLayout: LineLayerSpecification["layout"];
|
|
214
|
+
linePaint: LineLayerSpecification["paint"];
|
|
215
|
+
fillPaint: FillLayerSpecification["paint"];
|
|
216
|
+
}
|
|
217
|
+
interface MinimapOptionsInput {
|
|
218
|
+
/**
|
|
219
|
+
* Style of the map. Can be:
|
|
220
|
+
* - a full style URL (possibly with API key)
|
|
221
|
+
* - a shorthand with only the MapTIler style name (eg. `"streets-v2"`)
|
|
222
|
+
* - a longer form with the prefix `"maptiler://"` (eg. `"maptiler://streets-v2"`)
|
|
223
|
+
*/
|
|
224
|
+
style?: ReferenceMapStyle | MapStyleVariant | StyleSpecification | string;
|
|
225
|
+
/**
|
|
226
|
+
* Set the zoom difference between the parent and the minimap
|
|
227
|
+
* If the parent is zoomed to 10 and the minimap is zoomed to 8, the zoomAdjust should be 2
|
|
228
|
+
* Default: -4
|
|
229
|
+
*/
|
|
230
|
+
zoomAdjust?: number;
|
|
231
|
+
/** Set a zoom of the minimap and don't allow any future changes */
|
|
232
|
+
lockZoom?: number;
|
|
233
|
+
/** Adjust the pitch only if the user requests */
|
|
234
|
+
pitchAdjust?: boolean;
|
|
235
|
+
/** Set CSS properties of the container using object key-values */
|
|
236
|
+
containerStyle?: Record<string, string>;
|
|
237
|
+
/** Set the position of the minimap at either "top-left", "top-right", "bottom-left", or "bottom-right" */
|
|
238
|
+
position?: ControlPosition;
|
|
239
|
+
/** Set the parentRect fill and/or line options */
|
|
240
|
+
parentRect?: ParentRect;
|
|
241
|
+
}
|
|
242
|
+
|
|
174
243
|
type LoadWithTerrainEvent = {
|
|
175
244
|
type: "loadWithTerrain";
|
|
176
245
|
target: Map;
|
|
@@ -179,11 +248,6 @@ type LoadWithTerrainEvent = {
|
|
|
179
248
|
exaggeration: number;
|
|
180
249
|
};
|
|
181
250
|
};
|
|
182
|
-
type TransformStyleFunction = (previous: StyleSpecification, next: StyleSpecification) => StyleSpecification;
|
|
183
|
-
type StyleSwapOptions = {
|
|
184
|
-
diff?: boolean;
|
|
185
|
-
transformStyle?: TransformStyleFunction;
|
|
186
|
-
};
|
|
187
251
|
declare const GeolocationType: {
|
|
188
252
|
POINT: "POINT";
|
|
189
253
|
COUNTRY: "COUNTRY";
|
|
@@ -249,6 +313,15 @@ type MapOptions = Omit<MapOptions$1, "style" | "maplibreLogo"> & {
|
|
|
249
313
|
* Show the full screen control. (default: `false`, will show if `true`)
|
|
250
314
|
*/
|
|
251
315
|
fullscreenControl?: boolean | ControlPosition;
|
|
316
|
+
/**
|
|
317
|
+
* Display a minimap in a user defined corner of the map. (default: `bottom-left` corner)
|
|
318
|
+
* If set to true, the map will assume it is a minimap and forego the attribution control.
|
|
319
|
+
*/
|
|
320
|
+
minimap?: boolean | ControlPosition | MinimapOptionsInput;
|
|
321
|
+
/**
|
|
322
|
+
* attributionControl
|
|
323
|
+
*/
|
|
324
|
+
forceNoAttributionControl?: boolean;
|
|
252
325
|
/**
|
|
253
326
|
* Method to position the map at a given geolocation. Only if:
|
|
254
327
|
* - `hash` is `false`
|
|
@@ -277,9 +350,11 @@ declare class Map extends maplibre_gl__default.Map {
|
|
|
277
350
|
private isTerrainEnabled;
|
|
278
351
|
private terrainExaggeration;
|
|
279
352
|
private primaryLanguage;
|
|
280
|
-
private secondaryLanguage;
|
|
281
353
|
private terrainGrowing;
|
|
282
354
|
private terrainFlattening;
|
|
355
|
+
private minimap?;
|
|
356
|
+
private forceLanguageUpdate;
|
|
357
|
+
private languageAlwaysBeenStyle;
|
|
283
358
|
constructor(options: MapOptions);
|
|
284
359
|
/**
|
|
285
360
|
* Awaits for _this_ Map instance to be "loaded" and returns a Promise to the Map.
|
|
@@ -302,38 +377,138 @@ declare class Map extends maplibre_gl__default.Map {
|
|
|
302
377
|
* - a full style URL (possibly with API key)
|
|
303
378
|
* - a shorthand with only the MapTIler style name (eg. `"streets-v2"`)
|
|
304
379
|
* - a longer form with the prefix `"maptiler://"` (eg. `"maptiler://streets-v2"`)
|
|
305
|
-
* @param style
|
|
306
|
-
* @param options
|
|
307
|
-
* @returns
|
|
308
380
|
*/
|
|
309
|
-
setStyle(style: ReferenceMapStyle | MapStyleVariant | StyleSpecification | string, options?: StyleSwapOptions & StyleOptions): this;
|
|
381
|
+
setStyle(style: null | ReferenceMapStyle | MapStyleVariant | StyleSpecification | string, options?: StyleSwapOptions & StyleOptions): this;
|
|
310
382
|
/**
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
383
|
+
* Adds a [MapLibre style layer](https://maplibre.org/maplibre-style-spec/layers)
|
|
384
|
+
* to the map's style.
|
|
385
|
+
*
|
|
386
|
+
* A layer defines how data from a specified source will be styled. Read more about layer types
|
|
387
|
+
* and available paint and layout properties in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/layers).
|
|
388
|
+
*
|
|
389
|
+
* @param layer - The layer to add,
|
|
390
|
+
* conforming to either the MapLibre Style Specification's [layer definition](https://maplibre.org/maplibre-style-spec/layers) or,
|
|
391
|
+
* less commonly, the {@link CustomLayerInterface} specification.
|
|
392
|
+
* The MapLibre Style Specification's layer definition is appropriate for most layers.
|
|
393
|
+
*
|
|
394
|
+
* @param beforeId - The ID of an existing layer to insert the new layer before,
|
|
395
|
+
* resulting in the new layer appearing visually beneath the existing layer.
|
|
396
|
+
* If this argument is not specified, the layer will be appended to the end of the layers array
|
|
397
|
+
* and appear visually above all other layers.
|
|
398
|
+
*
|
|
399
|
+
* @returns `this`
|
|
314
400
|
*/
|
|
315
|
-
|
|
401
|
+
addLayer(layer: (LayerSpecification & {
|
|
402
|
+
source?: string | SourceSpecification;
|
|
403
|
+
}) | CustomLayerInterface, beforeId?: string): this;
|
|
404
|
+
/**
|
|
405
|
+
* Moves a layer to a different z-position.
|
|
406
|
+
*
|
|
407
|
+
* @param id - The ID of the layer to move.
|
|
408
|
+
* @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.
|
|
409
|
+
* @returns `this`
|
|
410
|
+
*
|
|
411
|
+
* @example
|
|
412
|
+
* 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.
|
|
413
|
+
* ```ts
|
|
414
|
+
* map.moveLayer('polygon', 'country-label');
|
|
415
|
+
* ```
|
|
416
|
+
*/
|
|
417
|
+
moveLayer(id: string, beforeId?: string): this;
|
|
418
|
+
/**
|
|
419
|
+
* Removes the layer with the given ID from the map's style.
|
|
420
|
+
*
|
|
421
|
+
* An {@link ErrorEvent} will be fired if the image parameter is invald.
|
|
422
|
+
*
|
|
423
|
+
* @param id - The ID of the layer to remove
|
|
424
|
+
* @returns `this`
|
|
425
|
+
*
|
|
426
|
+
* @example
|
|
427
|
+
* If a layer with ID 'state-data' exists, remove it.
|
|
428
|
+
* ```ts
|
|
429
|
+
* if (map.getLayer('state-data')) map.removeLayer('state-data');
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
432
|
+
removeLayer(id: string): this;
|
|
433
|
+
/**
|
|
434
|
+
* Sets the zoom extent for the specified style layer. The zoom extent includes the
|
|
435
|
+
* [minimum zoom level](https://maplibre.org/maplibre-style-spec/layers/#minzoom)
|
|
436
|
+
* and [maximum zoom level](https://maplibre.org/maplibre-style-spec/layers/#maxzoom))
|
|
437
|
+
* at which the layer will be rendered.
|
|
438
|
+
*
|
|
439
|
+
* Note: For style layers using vector sources, style layers cannot be rendered at zoom levels lower than the
|
|
440
|
+
* minimum zoom level of the _source layer_ because the data does not exist at those zoom levels. If the minimum
|
|
441
|
+
* zoom level of the source layer is higher than the minimum zoom level defined in the style layer, the style
|
|
442
|
+
* layer will not be rendered at all zoom levels in the zoom range.
|
|
443
|
+
*/
|
|
444
|
+
setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this;
|
|
445
|
+
/**
|
|
446
|
+
* Sets the filter for the specified style layer.
|
|
447
|
+
*
|
|
448
|
+
* Filters control which features a style layer renders from its source.
|
|
449
|
+
* Any feature for which the filter expression evaluates to `true` will be
|
|
450
|
+
* rendered on the map. Those that are false will be hidden.
|
|
451
|
+
*
|
|
452
|
+
* Use `setFilter` to show a subset of your source data.
|
|
453
|
+
*
|
|
454
|
+
* To clear the filter, pass `null` or `undefined` as the second parameter.
|
|
455
|
+
*/
|
|
456
|
+
setFilter(layerId: string, filter?: FilterSpecification | null, options?: StyleSetterOptions): this;
|
|
457
|
+
/**
|
|
458
|
+
* Sets the value of a paint property in the specified style layer.
|
|
459
|
+
*
|
|
460
|
+
* @param layerId - The ID of the layer to set the paint property in.
|
|
461
|
+
* @param name - The name of the paint property to set.
|
|
462
|
+
* @param value - The value of the paint property to set.
|
|
463
|
+
* Must be of a type appropriate for the property, as defined in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/).
|
|
464
|
+
* @param options - Options object.
|
|
465
|
+
* @returns `this`
|
|
466
|
+
* @example
|
|
467
|
+
* ```ts
|
|
468
|
+
* map.setPaintProperty('my-layer', 'fill-color', '#faafee');
|
|
469
|
+
* ```
|
|
470
|
+
*/
|
|
471
|
+
setPaintProperty(layerId: string, name: string, value: any, options?: StyleSetterOptions): this;
|
|
472
|
+
/**
|
|
473
|
+
* Sets the value of a layout property in the specified style layer.
|
|
474
|
+
* Layout properties define how the layer is styled.
|
|
475
|
+
* Layout properties for layers of the same type are documented together.
|
|
476
|
+
* Layers of different types have different layout properties.
|
|
477
|
+
* See the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/) for the complete list of layout properties.
|
|
478
|
+
* @param layerId - The ID of the layer to set the layout property in.
|
|
479
|
+
* @param name - The name of the layout property to set.
|
|
480
|
+
* @param value - The value of the layout property to set.
|
|
481
|
+
* Must be of a type appropriate for the property, as defined in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/).
|
|
482
|
+
* @param options - Options object.
|
|
483
|
+
* @returns `this`
|
|
484
|
+
*/
|
|
485
|
+
setLayoutProperty(layerId: string, name: string, value: any, options?: StyleSetterOptions): this;
|
|
486
|
+
/**
|
|
487
|
+
* Sets the value of the style's glyphs property.
|
|
488
|
+
*
|
|
489
|
+
* @param glyphsUrl - Glyph URL to set. Must conform to the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/glyphs/).
|
|
490
|
+
* @param options - Options object.
|
|
491
|
+
* @returns `this`
|
|
492
|
+
* @example
|
|
493
|
+
* ```ts
|
|
494
|
+
* map.setGlyphs('https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf');
|
|
495
|
+
* ```
|
|
496
|
+
*/
|
|
497
|
+
setGlyphs(glyphsUrl: string | null, options?: StyleSetterOptions): this;
|
|
498
|
+
private getStyleLanguage;
|
|
316
499
|
/**
|
|
317
500
|
* Define the primary language of the map. Note that not all the languages shorthands provided are available.
|
|
318
|
-
* @param language
|
|
319
501
|
*/
|
|
320
|
-
|
|
502
|
+
setLanguage(language: LanguageString | string): void;
|
|
321
503
|
/**
|
|
322
|
-
* Define the
|
|
323
|
-
* Note that most styles do not allow a secondary language and this function only works if the style allows (no force adding)
|
|
324
|
-
* @param language
|
|
504
|
+
* Define the primary language of the map. Note that not all the languages shorthands provided are available.
|
|
325
505
|
*/
|
|
326
|
-
|
|
506
|
+
private setPrimaryLanguage;
|
|
327
507
|
/**
|
|
328
508
|
* Get the primary language
|
|
329
509
|
* @returns
|
|
330
510
|
*/
|
|
331
511
|
getPrimaryLanguage(): LanguageString;
|
|
332
|
-
/**
|
|
333
|
-
* Get the secondary language
|
|
334
|
-
* @returns
|
|
335
|
-
*/
|
|
336
|
-
getSecondaryLanguage(): LanguageString;
|
|
337
512
|
/**
|
|
338
513
|
* Get the exaggeration factor applied to the terrain
|
|
339
514
|
* @returns
|
|
@@ -347,8 +522,6 @@ declare class Map extends maplibre_gl__default.Map {
|
|
|
347
522
|
private growTerrain;
|
|
348
523
|
/**
|
|
349
524
|
* Enables the 3D terrain visualization
|
|
350
|
-
* @param exaggeration
|
|
351
|
-
* @returns
|
|
352
525
|
*/
|
|
353
526
|
enableTerrain(exaggeration?: number): void;
|
|
354
527
|
/**
|
|
@@ -361,14 +534,11 @@ declare class Map extends maplibre_gl__default.Map {
|
|
|
361
534
|
* the method `.enableTerrain()` will be called.
|
|
362
535
|
* If `animate` is `true`, the terrain transformation will be animated in the span of 1 second.
|
|
363
536
|
* If `animate` is `false`, no animated transition to the newly defined exaggeration.
|
|
364
|
-
* @param exaggeration
|
|
365
|
-
* @param animate
|
|
366
537
|
*/
|
|
367
538
|
setTerrainExaggeration(exaggeration: number, animate?: boolean): void;
|
|
368
539
|
/**
|
|
369
540
|
* Perform an action when the style is ready. It could be at the moment of calling this method
|
|
370
541
|
* or later.
|
|
371
|
-
* @param cb
|
|
372
542
|
*/
|
|
373
543
|
private onStyleReady;
|
|
374
544
|
fitToIpBounds(): Promise<void>;
|
|
@@ -378,7 +548,6 @@ declare class Map extends maplibre_gl__default.Map {
|
|
|
378
548
|
* Get the SDK config object.
|
|
379
549
|
* This is convenient to dispatch the SDK configuration to externally built layers
|
|
380
550
|
* that do not directly have access to the SDK configuration but do have access to a Map instance.
|
|
381
|
-
* @returns
|
|
382
551
|
*/
|
|
383
552
|
getSdkConfig(): SdkConfig;
|
|
384
553
|
/**
|
|
@@ -399,6 +568,10 @@ declare class Map extends maplibre_gl__default.Map {
|
|
|
399
568
|
* map.setTransformRequest((url: string, resourceType: string) => {});
|
|
400
569
|
*/
|
|
401
570
|
setTransformRequest(transformRequest: RequestTransformFunction): this;
|
|
571
|
+
/**
|
|
572
|
+
* Loads an image. This is an async equivalent of `Map.loadImage`
|
|
573
|
+
*/
|
|
574
|
+
loadImageAsync(url: string): Promise<HTMLImageElement | ImageBitmap | null | undefined>;
|
|
402
575
|
}
|
|
403
576
|
|
|
404
577
|
/**
|
|
@@ -551,10 +724,10 @@ declare class MaptilerGeolocateControl extends GeolocateControl {
|
|
|
551
724
|
* @param {Position} position the Geolocation API Position
|
|
552
725
|
* @private
|
|
553
726
|
*/
|
|
554
|
-
_updateCamera(position: GeolocationPosition)
|
|
555
|
-
_setupUI(supported: boolean)
|
|
727
|
+
_updateCamera: (position: GeolocationPosition) => void;
|
|
728
|
+
_setupUI: (supported: boolean) => void;
|
|
556
729
|
_updateCircleRadius(): void;
|
|
557
|
-
_onZoom()
|
|
730
|
+
_onZoom: () => void;
|
|
558
731
|
}
|
|
559
732
|
|
|
560
733
|
type LogoOptions = LogoOptions$1 & {
|
|
@@ -566,6 +739,7 @@ type LogoOptions = LogoOptions$1 & {
|
|
|
566
739
|
* any link URL. By default this is using MapTiler logo and URL.
|
|
567
740
|
*/
|
|
568
741
|
declare class MaptilerLogoControl extends LogoControl {
|
|
742
|
+
_compact: boolean;
|
|
569
743
|
private logoURL;
|
|
570
744
|
private linkURL;
|
|
571
745
|
constructor(options?: LogoOptions);
|
|
@@ -576,7 +750,7 @@ declare class MaptilerLogoControl extends LogoControl {
|
|
|
576
750
|
* A `MaptilerTerrainControl` control adds a button to turn terrain on and off
|
|
577
751
|
* by triggering the terrain logic that is already deployed in the Map object.
|
|
578
752
|
*/
|
|
579
|
-
declare class MaptilerTerrainControl implements
|
|
753
|
+
declare class MaptilerTerrainControl implements IControl {
|
|
580
754
|
_map: Map;
|
|
581
755
|
_container: HTMLElement;
|
|
582
756
|
_terrainButton: HTMLButtonElement;
|
|
@@ -588,18 +762,18 @@ declare class MaptilerTerrainControl implements maplibregl.IControl {
|
|
|
588
762
|
}
|
|
589
763
|
|
|
590
764
|
type HTMLButtonElementPlus = HTMLButtonElement & {
|
|
591
|
-
clickFunction: (e?:
|
|
765
|
+
clickFunction: (e?: Event) => unknown;
|
|
592
766
|
};
|
|
593
767
|
declare class MaptilerNavigationControl extends NavigationControl {
|
|
594
768
|
constructor();
|
|
595
769
|
/**
|
|
596
770
|
* Overloading: the button now stores its click callback so that we can later on delete it and replace it
|
|
597
771
|
*/
|
|
598
|
-
_createButton(className: string, fn: (e?:
|
|
772
|
+
_createButton(className: string, fn: (e?: Event) => unknown): HTMLButtonElementPlus;
|
|
599
773
|
/**
|
|
600
774
|
* Overloading: Limit how flat the compass icon can get
|
|
601
775
|
*/
|
|
602
|
-
_rotateCompassArrow()
|
|
776
|
+
_rotateCompassArrow: () => void;
|
|
603
777
|
}
|
|
604
778
|
|
|
605
779
|
/**
|
|
@@ -612,8 +786,6 @@ declare class MaptilerNavigationControl extends NavigationControl {
|
|
|
612
786
|
type Matrix2 = [number, number, number, number];
|
|
613
787
|
/**
|
|
614
788
|
* a point
|
|
615
|
-
* @param x
|
|
616
|
-
* @param y
|
|
617
789
|
*/
|
|
618
790
|
declare class Point {
|
|
619
791
|
x: number;
|
|
@@ -734,13 +906,13 @@ declare class Point {
|
|
|
734
906
|
* @param {Point} other the other point
|
|
735
907
|
* @return {boolean} whether the points are equal
|
|
736
908
|
*/
|
|
737
|
-
equals(other:
|
|
909
|
+
equals(other: Point): boolean;
|
|
738
910
|
/**
|
|
739
911
|
* Calculate the distance from this point to another point
|
|
740
912
|
* @param {Point} p the other point
|
|
741
913
|
* @return {Number} distance
|
|
742
914
|
*/
|
|
743
|
-
dist(p:
|
|
915
|
+
dist(p: Point): number;
|
|
744
916
|
/**
|
|
745
917
|
* Calculate the distance from this point to another point,
|
|
746
918
|
* without the square root step. Useful if you're comparing
|
|
@@ -748,7 +920,7 @@ declare class Point {
|
|
|
748
920
|
* @param {Point} p the other point
|
|
749
921
|
* @return {Number} distance
|
|
750
922
|
*/
|
|
751
|
-
distSqr(p:
|
|
923
|
+
distSqr(p: Point): number;
|
|
752
924
|
/**
|
|
753
925
|
* Get the angle from the 0, 0 coordinate to this point, in radians
|
|
754
926
|
* coordinates.
|
|
@@ -782,7 +954,919 @@ declare class Point {
|
|
|
782
954
|
static convert(a: Point | Array<number>): Point;
|
|
783
955
|
}
|
|
784
956
|
|
|
785
|
-
|
|
957
|
+
interface Link {
|
|
958
|
+
href: string | null;
|
|
959
|
+
}
|
|
960
|
+
interface XMLProperties {
|
|
961
|
+
links?: Link[];
|
|
962
|
+
}
|
|
963
|
+
interface PlacemarkProperties {
|
|
964
|
+
name?: string;
|
|
965
|
+
address?: string;
|
|
966
|
+
styleUrl?: string;
|
|
967
|
+
description?: string;
|
|
968
|
+
styleHash?: string;
|
|
969
|
+
styleMapHash?: Record<string, string | null>;
|
|
970
|
+
timespan?: {
|
|
971
|
+
begin: string;
|
|
972
|
+
end: string;
|
|
973
|
+
};
|
|
974
|
+
timestamp?: string;
|
|
975
|
+
stroke?: string;
|
|
976
|
+
"stroke-opacity"?: number;
|
|
977
|
+
"stroke-width"?: number;
|
|
978
|
+
fill?: string;
|
|
979
|
+
"fill-opacity"?: number;
|
|
980
|
+
visibility?: string;
|
|
981
|
+
icon?: string;
|
|
982
|
+
coordTimes?: (string | null)[] | (string | null)[][];
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* create a function that converts a string to XML
|
|
986
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
|
|
987
|
+
*/
|
|
988
|
+
declare function str2xml(str: string): Document;
|
|
989
|
+
/**
|
|
990
|
+
* Check one of the top level child node is of a given type ("gpx", "kml").
|
|
991
|
+
* The check is not case sensitive.
|
|
992
|
+
* @param doc
|
|
993
|
+
* @param nodeName
|
|
994
|
+
* @returns
|
|
995
|
+
*/
|
|
996
|
+
declare function hasChildNodeWithName(doc: Document, nodeName: string): boolean;
|
|
997
|
+
/**
|
|
998
|
+
* create a function that converts a XML to a string
|
|
999
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/XMLSerializer
|
|
1000
|
+
*/
|
|
1001
|
+
declare function xml2str(node: Node): string;
|
|
1002
|
+
/**
|
|
1003
|
+
* Given a XML document using the GPX spec, return GeoJSON
|
|
1004
|
+
*/
|
|
1005
|
+
declare function gpx(doc: string | Document): GeoJSON.FeatureCollection;
|
|
1006
|
+
/**
|
|
1007
|
+
* Given a XML document using the KML spec, return GeoJSON
|
|
1008
|
+
*/
|
|
1009
|
+
declare function kml(doc: string | Document, xml2string?: (node: Node) => string): GeoJSON.FeatureCollection;
|
|
1010
|
+
declare function gpxOrKml(doc: string | Document): GeoJSON.FeatureCollection | null;
|
|
1011
|
+
|
|
1012
|
+
type RgbaColor = [number, number, number] | [number, number, number, number];
|
|
1013
|
+
type ColorStop = {
|
|
1014
|
+
/**
|
|
1015
|
+
* The "value" at which this ColorStop should be applied.
|
|
1016
|
+
*/
|
|
1017
|
+
value: number;
|
|
1018
|
+
/**
|
|
1019
|
+
* RGB[A] - Array of 3-4 numbers. 0-255 per channel.
|
|
1020
|
+
*/
|
|
1021
|
+
color: RgbaColor;
|
|
1022
|
+
};
|
|
1023
|
+
/**
|
|
1024
|
+
* A RGBA color as per the array definition
|
|
1025
|
+
*/
|
|
1026
|
+
type ArrayColor = [number, number, number, number];
|
|
1027
|
+
/**
|
|
1028
|
+
* A color ramp stop as per array definition
|
|
1029
|
+
*/
|
|
1030
|
+
type ArrayColorRampStop = [
|
|
1031
|
+
/**
|
|
1032
|
+
* Real world value in a real world unit
|
|
1033
|
+
*/
|
|
1034
|
+
number,
|
|
1035
|
+
/**
|
|
1036
|
+
* Color RGBA
|
|
1037
|
+
*/
|
|
1038
|
+
ArrayColor
|
|
1039
|
+
];
|
|
1040
|
+
/**
|
|
1041
|
+
* A color ramp as per array definition
|
|
1042
|
+
*/
|
|
1043
|
+
type ArrayColorRamp = Array<ArrayColorRampStop>;
|
|
1044
|
+
type ColorRampOptions = {
|
|
1045
|
+
/**
|
|
1046
|
+
* The value the colorramp starts
|
|
1047
|
+
*/
|
|
1048
|
+
min?: number;
|
|
1049
|
+
/**
|
|
1050
|
+
* The value the colorramp ends
|
|
1051
|
+
*/
|
|
1052
|
+
max?: number;
|
|
1053
|
+
/**
|
|
1054
|
+
* Some color stops to copy from
|
|
1055
|
+
*/
|
|
1056
|
+
stops?: Array<ColorStop>;
|
|
1057
|
+
};
|
|
1058
|
+
declare class ColorRamp extends Array<ColorStop> {
|
|
1059
|
+
/**
|
|
1060
|
+
* Converts a array-definition color ramp definition into a usable ColorRamp instance.
|
|
1061
|
+
* Note: units are not converted and may need to to be converted beforehand (eg. kelvin to centigrade)
|
|
1062
|
+
* @param cr
|
|
1063
|
+
* @returns
|
|
1064
|
+
*/
|
|
1065
|
+
static fromArrayDefinition(cr: ArrayColorRamp): ColorRamp;
|
|
1066
|
+
private min;
|
|
1067
|
+
private max;
|
|
1068
|
+
constructor(options?: ColorRampOptions);
|
|
1069
|
+
setStops(stops: Array<ColorStop>, options?: {
|
|
1070
|
+
clone?: boolean;
|
|
1071
|
+
}): ColorRamp;
|
|
1072
|
+
scale(min: number, max: number, options?: {
|
|
1073
|
+
clone?: boolean;
|
|
1074
|
+
}): ColorRamp;
|
|
1075
|
+
at(pos: number): ColorStop;
|
|
1076
|
+
clone(): ColorRamp;
|
|
1077
|
+
getRawColorStops(): Array<ColorStop>;
|
|
1078
|
+
reverse(options?: {
|
|
1079
|
+
clone?: boolean;
|
|
1080
|
+
}): ColorRamp;
|
|
1081
|
+
getBounds(): {
|
|
1082
|
+
min: number;
|
|
1083
|
+
max: number;
|
|
1084
|
+
};
|
|
1085
|
+
getColor(value: number, options?: {
|
|
1086
|
+
smooth?: boolean;
|
|
1087
|
+
}): RgbaColor;
|
|
1088
|
+
/**
|
|
1089
|
+
* Get the color as an hexadecimal string
|
|
1090
|
+
*/
|
|
1091
|
+
getColorHex(value: number, options?: {
|
|
1092
|
+
smooth?: boolean;
|
|
1093
|
+
withAlpha?: boolean;
|
|
1094
|
+
}): string;
|
|
1095
|
+
/**
|
|
1096
|
+
* Get the color of the color ramp at a relative position in [0, 1]
|
|
1097
|
+
*/
|
|
1098
|
+
getColorRelative(value: number, options?: {
|
|
1099
|
+
smooth?: boolean;
|
|
1100
|
+
}): RgbaColor;
|
|
1101
|
+
getCanvasStrip(options?: {
|
|
1102
|
+
horizontal?: boolean;
|
|
1103
|
+
size?: number;
|
|
1104
|
+
smooth?: boolean;
|
|
1105
|
+
}): HTMLCanvasElement;
|
|
1106
|
+
/**
|
|
1107
|
+
* Apply a non-linear ressampling. This will create a new instance of ColorRamp with the same bounds.
|
|
1108
|
+
*/
|
|
1109
|
+
resample(method: "ease-in-square" | "ease-out-square" | "ease-in-sqrt" | "ease-out-sqrt" | "ease-in-exp" | "ease-out-exp", samples?: number): ColorRamp;
|
|
1110
|
+
/**
|
|
1111
|
+
* Makes a clone of this color ramp that is fully transparant at the begining of their range
|
|
1112
|
+
*/
|
|
1113
|
+
transparentStart(): ColorRamp;
|
|
1114
|
+
/**
|
|
1115
|
+
* Check if this color ramp has a transparent start
|
|
1116
|
+
*/
|
|
1117
|
+
hasTransparentStart(): boolean;
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* This is a collection of built-in color ramps. They are all defined in the range [0, 1]
|
|
1121
|
+
* but can be scaled or reversed to fit specific usages.
|
|
1122
|
+
*/
|
|
1123
|
+
declare const ColorRampCollection: {
|
|
1124
|
+
/**
|
|
1125
|
+
* A fully transparent [0, 0, 0, 0] colorramp to hide data.
|
|
1126
|
+
* Defined in interval [0, 1], without unit.
|
|
1127
|
+
*/
|
|
1128
|
+
NULL: ColorRamp;
|
|
1129
|
+
GRAY: ColorRamp;
|
|
1130
|
+
/**
|
|
1131
|
+
* Classic jet color ramp.
|
|
1132
|
+
* Defined in interval [0, 1], without unit.
|
|
1133
|
+
*/
|
|
1134
|
+
JET: ColorRamp;
|
|
1135
|
+
/**
|
|
1136
|
+
* Classic HSV color ramp (hue, saturation, value).
|
|
1137
|
+
* Defined in interval [0, 1], without unit.
|
|
1138
|
+
*/
|
|
1139
|
+
HSV: ColorRamp;
|
|
1140
|
+
/**
|
|
1141
|
+
* Classic hot color ramp.
|
|
1142
|
+
* Defined in interval [0, 1], without unit.
|
|
1143
|
+
*/
|
|
1144
|
+
HOT: ColorRamp;
|
|
1145
|
+
/**
|
|
1146
|
+
* Classic spring color ramp.
|
|
1147
|
+
* Defined in interval [0, 1], without unit.
|
|
1148
|
+
*/
|
|
1149
|
+
SPRING: ColorRamp;
|
|
1150
|
+
/**
|
|
1151
|
+
* Classic summer color ramp.
|
|
1152
|
+
* Defined in interval [0, 1], without unit.
|
|
1153
|
+
*/
|
|
1154
|
+
SUMMER: ColorRamp;
|
|
1155
|
+
/**
|
|
1156
|
+
* Classic autommn color ramp.
|
|
1157
|
+
* Defined in interval [0, 1], without unit.
|
|
1158
|
+
*/
|
|
1159
|
+
AUTOMN: ColorRamp;
|
|
1160
|
+
/**
|
|
1161
|
+
* Classic winter color ramp.
|
|
1162
|
+
* Defined in interval [0, 1], without unit.
|
|
1163
|
+
*/
|
|
1164
|
+
WINTER: ColorRamp;
|
|
1165
|
+
/**
|
|
1166
|
+
* Classic bone color ramp.
|
|
1167
|
+
* Defined in interval [0, 1], without unit.
|
|
1168
|
+
*/
|
|
1169
|
+
BONE: ColorRamp;
|
|
1170
|
+
/**
|
|
1171
|
+
* Classic copper color ramp.
|
|
1172
|
+
* Defined in interval [0, 1], without unit.
|
|
1173
|
+
*/
|
|
1174
|
+
COPPER: ColorRamp;
|
|
1175
|
+
/**
|
|
1176
|
+
* Classic greys color ramp.
|
|
1177
|
+
* Defined in interval [0, 1], without unit.
|
|
1178
|
+
*/
|
|
1179
|
+
GREYS: ColorRamp;
|
|
1180
|
+
/**
|
|
1181
|
+
* Classic yignbu color ramp (blue to light yellow).
|
|
1182
|
+
* Defined in interval [0, 1], without unit.
|
|
1183
|
+
*/
|
|
1184
|
+
YIGNBU: ColorRamp;
|
|
1185
|
+
/**
|
|
1186
|
+
* Classic greens color ramp.
|
|
1187
|
+
* Defined in interval [0, 1], without unit.
|
|
1188
|
+
*/
|
|
1189
|
+
GREENS: ColorRamp;
|
|
1190
|
+
/**
|
|
1191
|
+
* Classic yiorrd color ramp (red to light yellow).
|
|
1192
|
+
* Defined in interval [0, 1], without unit.
|
|
1193
|
+
*/
|
|
1194
|
+
YIORRD: ColorRamp;
|
|
1195
|
+
/**
|
|
1196
|
+
* Classic blue-red color ramp.
|
|
1197
|
+
* Defined in interval [0, 1], without unit.
|
|
1198
|
+
*/
|
|
1199
|
+
BLUERED: ColorRamp;
|
|
1200
|
+
/**
|
|
1201
|
+
* Classic rdbu color ramp.
|
|
1202
|
+
* Defined in interval [0, 1], without unit.
|
|
1203
|
+
*/
|
|
1204
|
+
RDBU: ColorRamp;
|
|
1205
|
+
/**
|
|
1206
|
+
* Classic picnic color ramp.
|
|
1207
|
+
* Defined in interval [0, 1], without unit.
|
|
1208
|
+
*/
|
|
1209
|
+
PICNIC: ColorRamp;
|
|
1210
|
+
/**
|
|
1211
|
+
* Classic rainbow color ramp.
|
|
1212
|
+
* Defined in interval [0, 1], without unit.
|
|
1213
|
+
*/
|
|
1214
|
+
RAINBOW: ColorRamp;
|
|
1215
|
+
/**
|
|
1216
|
+
* Classic Portland color ramp.
|
|
1217
|
+
* Defined in interval [0, 1], without unit.
|
|
1218
|
+
*/
|
|
1219
|
+
PORTLAND: ColorRamp;
|
|
1220
|
+
/**
|
|
1221
|
+
* Classic blackbody color ramp.
|
|
1222
|
+
* Defined in interval [0, 1], without unit.
|
|
1223
|
+
*/
|
|
1224
|
+
BLACKBODY: ColorRamp;
|
|
1225
|
+
/**
|
|
1226
|
+
* Classic earth color ramp.
|
|
1227
|
+
* Defined in interval [0, 1], without unit.
|
|
1228
|
+
*/
|
|
1229
|
+
EARTH: ColorRamp;
|
|
1230
|
+
/**
|
|
1231
|
+
* Classic electric color ramp.
|
|
1232
|
+
* Defined in interval [0, 1], without unit.
|
|
1233
|
+
*/
|
|
1234
|
+
ELECTRIC: ColorRamp;
|
|
1235
|
+
/**
|
|
1236
|
+
* Classic viridis color ramp.
|
|
1237
|
+
* Defined in interval [0, 1], without unit.
|
|
1238
|
+
*/
|
|
1239
|
+
VIRIDIS: ColorRamp;
|
|
1240
|
+
/**
|
|
1241
|
+
* Classic inferno color ramp.
|
|
1242
|
+
* Defined in interval [0, 1], without unit.
|
|
1243
|
+
*/
|
|
1244
|
+
INFERNO: ColorRamp;
|
|
1245
|
+
/**
|
|
1246
|
+
* Classic magma color ramp.
|
|
1247
|
+
* Defined in interval [0, 1], without unit.
|
|
1248
|
+
*/
|
|
1249
|
+
MAGMA: ColorRamp;
|
|
1250
|
+
/**
|
|
1251
|
+
* Classic plasma color ramp.
|
|
1252
|
+
* Defined in interval [0, 1], without unit.
|
|
1253
|
+
*/
|
|
1254
|
+
PLASMA: ColorRamp;
|
|
1255
|
+
/**
|
|
1256
|
+
* Classic warm color ramp.
|
|
1257
|
+
* Defined in interval [0, 1], without unit.
|
|
1258
|
+
*/
|
|
1259
|
+
WARM: ColorRamp;
|
|
1260
|
+
/**
|
|
1261
|
+
* Classic cool color ramp.
|
|
1262
|
+
* Defined in interval [0, 1], without unit.
|
|
1263
|
+
*/
|
|
1264
|
+
COOL: ColorRamp;
|
|
1265
|
+
/**
|
|
1266
|
+
* Classic rainboz soft color ramp.
|
|
1267
|
+
* Defined in interval [0, 1], without unit.
|
|
1268
|
+
*/
|
|
1269
|
+
RAINBOW_SOFT: ColorRamp;
|
|
1270
|
+
/**
|
|
1271
|
+
* Classic bathymetry color ramp.
|
|
1272
|
+
* Defined in interval [0, 1], without unit.
|
|
1273
|
+
*/
|
|
1274
|
+
BATHYMETRY: ColorRamp;
|
|
1275
|
+
/**
|
|
1276
|
+
* Classic cdom color ramp.
|
|
1277
|
+
* Defined in interval [0, 1], without unit.
|
|
1278
|
+
*/
|
|
1279
|
+
CDOM: ColorRamp;
|
|
1280
|
+
/**
|
|
1281
|
+
* Classic chlorophyll color ramp.
|
|
1282
|
+
* Defined in interval [0, 1], without unit.
|
|
1283
|
+
*/
|
|
1284
|
+
CHLOROPHYLL: ColorRamp;
|
|
1285
|
+
/**
|
|
1286
|
+
* Classic density color ramp.
|
|
1287
|
+
* Defined in interval [0, 1], without unit.
|
|
1288
|
+
*/
|
|
1289
|
+
DENSITY: ColorRamp;
|
|
1290
|
+
/**
|
|
1291
|
+
* Classic freesurface blue color ramp.
|
|
1292
|
+
* Defined in interval [0, 1], without unit.
|
|
1293
|
+
*/
|
|
1294
|
+
FREESURFACE_BLUE: ColorRamp;
|
|
1295
|
+
/**
|
|
1296
|
+
* Classic freesurface red color ramp.
|
|
1297
|
+
* Defined in interval [0, 1], without unit.
|
|
1298
|
+
*/
|
|
1299
|
+
FREESURFACE_RED: ColorRamp;
|
|
1300
|
+
/**
|
|
1301
|
+
* Classic oxygen color ramp.
|
|
1302
|
+
* Defined in interval [0, 1], without unit.
|
|
1303
|
+
*/
|
|
1304
|
+
OXYGEN: ColorRamp;
|
|
1305
|
+
/**
|
|
1306
|
+
* Classic par color ramp.
|
|
1307
|
+
* Defined in interval [0, 1], without unit.
|
|
1308
|
+
*/
|
|
1309
|
+
PAR: ColorRamp;
|
|
1310
|
+
/**
|
|
1311
|
+
* Classic phase color ramp.
|
|
1312
|
+
* Defined in interval [0, 1], without unit.
|
|
1313
|
+
*/
|
|
1314
|
+
PHASE: ColorRamp;
|
|
1315
|
+
/**
|
|
1316
|
+
* Classic salinity color ramp.
|
|
1317
|
+
* Defined in interval [0, 1], without unit.
|
|
1318
|
+
*/
|
|
1319
|
+
SALINITY: ColorRamp;
|
|
1320
|
+
/**
|
|
1321
|
+
* Classic temperature color ramp.
|
|
1322
|
+
* Defined in interval [0, 1], without unit.
|
|
1323
|
+
*/
|
|
1324
|
+
TEMPERATURE: ColorRamp;
|
|
1325
|
+
/**
|
|
1326
|
+
* Classic turbidity color ramp.
|
|
1327
|
+
* Defined in interval [0, 1], without unit.
|
|
1328
|
+
*/
|
|
1329
|
+
TURBIDITY: ColorRamp;
|
|
1330
|
+
/**
|
|
1331
|
+
* Classic velocity blue color ramp.
|
|
1332
|
+
* Defined in interval [0, 1], without unit.
|
|
1333
|
+
*/
|
|
1334
|
+
VELOCITY_BLUE: ColorRamp;
|
|
1335
|
+
/**
|
|
1336
|
+
* Classic velocity green color ramp.
|
|
1337
|
+
* Defined in interval [0, 1], without unit.
|
|
1338
|
+
*/
|
|
1339
|
+
VELOCITY_GREEN: ColorRamp;
|
|
1340
|
+
/**
|
|
1341
|
+
* Classic cube helix color ramp.
|
|
1342
|
+
* Defined in interval [0, 1], without unit.
|
|
1343
|
+
*/
|
|
1344
|
+
CUBEHELIX: ColorRamp;
|
|
1345
|
+
/**
|
|
1346
|
+
* The cividis color ramp is color blind friendly.
|
|
1347
|
+
* Read more here https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0199239
|
|
1348
|
+
* Defined in interval [0, 1], without unit.
|
|
1349
|
+
*/
|
|
1350
|
+
CIVIDIS: ColorRamp;
|
|
1351
|
+
/**
|
|
1352
|
+
* Classic turbo color ramp.
|
|
1353
|
+
* This is a luminance-constant alternative to the jet, making it more
|
|
1354
|
+
* clor-blind friendly.
|
|
1355
|
+
* Defined in interval [0, 1], without unit.
|
|
1356
|
+
*/
|
|
1357
|
+
TURBO: ColorRamp;
|
|
1358
|
+
/**
|
|
1359
|
+
* The rocket color ramp is perceptually uniform, which makes it more
|
|
1360
|
+
* color bliend friendly than the classic magma color ramp.
|
|
1361
|
+
* Defined in interval [0, 1], without unit.
|
|
1362
|
+
*/
|
|
1363
|
+
ROCKET: ColorRamp;
|
|
1364
|
+
/**
|
|
1365
|
+
* The mako color ramp is perceptually uniform and can be seen as
|
|
1366
|
+
* a color blind friendly alternative to bathymetry or yignbu.
|
|
1367
|
+
* Defined in interval [0, 1], without unit.
|
|
1368
|
+
*/
|
|
1369
|
+
MAKO: ColorRamp;
|
|
1370
|
+
};
|
|
1371
|
+
|
|
1372
|
+
/**
|
|
1373
|
+
* Array of string values that depend on zoom level
|
|
1374
|
+
*/
|
|
1375
|
+
type ZoomStringValues = Array<{
|
|
1376
|
+
/**
|
|
1377
|
+
* Zoom level
|
|
1378
|
+
*/
|
|
1379
|
+
zoom: number;
|
|
1380
|
+
/**
|
|
1381
|
+
* Value for the given zoom level
|
|
1382
|
+
*/
|
|
1383
|
+
value: string;
|
|
1384
|
+
}>;
|
|
1385
|
+
/**
|
|
1386
|
+
*
|
|
1387
|
+
* Array of number values that depend on zoom level
|
|
1388
|
+
*/
|
|
1389
|
+
type ZoomNumberValues = Array<{
|
|
1390
|
+
/**
|
|
1391
|
+
* Zoom level
|
|
1392
|
+
*/
|
|
1393
|
+
zoom: number;
|
|
1394
|
+
/**
|
|
1395
|
+
* Value for the given zoom level
|
|
1396
|
+
*/
|
|
1397
|
+
value: number;
|
|
1398
|
+
}>;
|
|
1399
|
+
type PropertyValues = Array<{
|
|
1400
|
+
/**
|
|
1401
|
+
* Value of the property (input)
|
|
1402
|
+
*/
|
|
1403
|
+
propertyValue: number;
|
|
1404
|
+
/**
|
|
1405
|
+
* Value to associate it with (output)
|
|
1406
|
+
*/
|
|
1407
|
+
value: number;
|
|
1408
|
+
}>;
|
|
1409
|
+
type CommonShapeLayerOptions = {
|
|
1410
|
+
/**
|
|
1411
|
+
* ID to give to the layer.
|
|
1412
|
+
* If not provided, an auto-generated ID of the for "maptiler-layer-xxxxxx" will be auto-generated,
|
|
1413
|
+
* with "xxxxxx" being a random string.
|
|
1414
|
+
*/
|
|
1415
|
+
layerId?: string;
|
|
1416
|
+
/**
|
|
1417
|
+
* ID to give to the geojson source.
|
|
1418
|
+
* If not provided, an auto-generated ID of the for "maptiler-source-xxxxxx" will be auto-generated,
|
|
1419
|
+
* with "xxxxxx" being a random string.
|
|
1420
|
+
*/
|
|
1421
|
+
sourceId?: string;
|
|
1422
|
+
/**
|
|
1423
|
+
* A geojson Feature collection or a URL to a geojson or the UUID of a MapTiler Cloud dataset.
|
|
1424
|
+
*/
|
|
1425
|
+
data: FeatureCollection | string;
|
|
1426
|
+
/**
|
|
1427
|
+
* The ID of an existing layer to insert the new layer before, resulting in the new layer appearing
|
|
1428
|
+
* visually beneath the existing layer. If this argument is not specified, the layer will be appended
|
|
1429
|
+
* to the end of the layers array and appear visually above all other layers.
|
|
1430
|
+
*/
|
|
1431
|
+
beforeId?: string;
|
|
1432
|
+
/**
|
|
1433
|
+
* Zoom level at which it starts to show.
|
|
1434
|
+
* Default: `0`
|
|
1435
|
+
*/
|
|
1436
|
+
minzoom?: number;
|
|
1437
|
+
/**
|
|
1438
|
+
* Zoom level after which it no longer show.
|
|
1439
|
+
* Default: `22`
|
|
1440
|
+
*/
|
|
1441
|
+
maxzoom?: number;
|
|
1442
|
+
/**
|
|
1443
|
+
* Whether or not to add an outline.
|
|
1444
|
+
* Default: `false`
|
|
1445
|
+
*/
|
|
1446
|
+
outline?: boolean;
|
|
1447
|
+
/**
|
|
1448
|
+
* Color of the outline. This is can be a constant color string or a definition based on zoom levels.
|
|
1449
|
+
* Applies only if `.outline` is `true`.
|
|
1450
|
+
* Default: `white`
|
|
1451
|
+
*/
|
|
1452
|
+
outlineColor?: string | ZoomStringValues;
|
|
1453
|
+
/**
|
|
1454
|
+
* Width of the outline (relative to screen-space). This is can be a constant width or a definition based on zoom levels.
|
|
1455
|
+
* Applies only if `.outline` is `true`.
|
|
1456
|
+
* Default: `1`
|
|
1457
|
+
*/
|
|
1458
|
+
outlineWidth?: number | ZoomNumberValues;
|
|
1459
|
+
/**
|
|
1460
|
+
* Opacity of the outline. This is can be a constant opacity in [0, 1] or a definition based on zoom levels
|
|
1461
|
+
* Applies only if `.outline` is `true`.
|
|
1462
|
+
* Default: `1`
|
|
1463
|
+
*/
|
|
1464
|
+
outlineOpacity?: number | ZoomNumberValues;
|
|
1465
|
+
};
|
|
1466
|
+
type PolylineLayerOptions = CommonShapeLayerOptions & {
|
|
1467
|
+
/**
|
|
1468
|
+
* Color of the line (or polyline). This is can be a constant color string or a definition based on zoom levels.
|
|
1469
|
+
* Default: a color randomly pick from a list
|
|
1470
|
+
*/
|
|
1471
|
+
lineColor?: string | ZoomStringValues;
|
|
1472
|
+
/**
|
|
1473
|
+
* Width of the line (relative to screen-space). This is can be a constant width or a definition based on zoom levels
|
|
1474
|
+
* Default: `3`
|
|
1475
|
+
*/
|
|
1476
|
+
lineWidth?: number | ZoomNumberValues;
|
|
1477
|
+
/**
|
|
1478
|
+
* Opacity of the line. This is can be a constant opacity in [0, 1] or a definition based on zoom levels.
|
|
1479
|
+
* Default: `1`
|
|
1480
|
+
*/
|
|
1481
|
+
lineOpacity?: number | ZoomNumberValues;
|
|
1482
|
+
/**
|
|
1483
|
+
* How blury the line is, with `0` being no blur and `10` and beyond being quite blurry.
|
|
1484
|
+
* Default: `0`
|
|
1485
|
+
*/
|
|
1486
|
+
lineBlur?: number | ZoomNumberValues;
|
|
1487
|
+
/**
|
|
1488
|
+
* Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.
|
|
1489
|
+
* Default: `0`
|
|
1490
|
+
*/
|
|
1491
|
+
lineGapWidth?: number | ZoomNumberValues;
|
|
1492
|
+
/**
|
|
1493
|
+
* Sequence of line and void to create a dash pattern. The unit is the line width so that
|
|
1494
|
+
* a dash array value of `[3, 1]` will create a segment worth 3 times the width of the line,
|
|
1495
|
+
* followed by a spacing worth 1 time the line width, and then repeat.
|
|
1496
|
+
*
|
|
1497
|
+
* Alternatively, this property can be a string made of underscore and whitespace characters
|
|
1498
|
+
* such as `"___ _ "` and internaly this will be translated into [3, 1, 1, 1]. Note that
|
|
1499
|
+
* this way of describing dash arrays with a string only works for integer values.
|
|
1500
|
+
*
|
|
1501
|
+
* Dash arrays can contain more than 2 element to create more complex patters. For instance
|
|
1502
|
+
* a dash array value of [3, 2, 1, 2] will create the following sequence:
|
|
1503
|
+
* - a segment worth 3 times the width
|
|
1504
|
+
* - a spacing worth 2 times the width
|
|
1505
|
+
* - a segment worth 1 times the width
|
|
1506
|
+
* - a spacing worth 2 times the width
|
|
1507
|
+
* - repeat
|
|
1508
|
+
*
|
|
1509
|
+
* Default: no dash pattern
|
|
1510
|
+
*/
|
|
1511
|
+
lineDashArray?: Array<number> | string;
|
|
1512
|
+
/**
|
|
1513
|
+
* The display of line endings for both the line and the outline (if `.outline` is `true`)
|
|
1514
|
+
* - "butt": A cap with a squared-off end which is drawn to the exact endpoint of the line.
|
|
1515
|
+
* - "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.
|
|
1516
|
+
* - "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.
|
|
1517
|
+
* Default: "round"
|
|
1518
|
+
*/
|
|
1519
|
+
lineCap?: "butt" | "round" | "square";
|
|
1520
|
+
/**
|
|
1521
|
+
* The display of lines when joining for both the line and the outline (if `.outline` is `true`)
|
|
1522
|
+
* - "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.
|
|
1523
|
+
* - "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.
|
|
1524
|
+
* - "miter": A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet.
|
|
1525
|
+
* Default: "round"
|
|
1526
|
+
*/
|
|
1527
|
+
lineJoin?: "bevel" | "round" | "miter";
|
|
1528
|
+
/**
|
|
1529
|
+
* How blury the outline is, with `0` being no blur and `10` and beyond being quite blurry.
|
|
1530
|
+
* Applies only if `.outline` is `true`.
|
|
1531
|
+
* Default: `0`
|
|
1532
|
+
*/
|
|
1533
|
+
outlineBlur?: number | ZoomNumberValues;
|
|
1534
|
+
};
|
|
1535
|
+
type PolygonLayerOptions = CommonShapeLayerOptions & {
|
|
1536
|
+
/**
|
|
1537
|
+
* Color of the polygon. This is can be a constant color string or a definition based on zoom levels.
|
|
1538
|
+
* Default: a color randomly pick from a list
|
|
1539
|
+
*/
|
|
1540
|
+
fillColor?: string | ZoomStringValues;
|
|
1541
|
+
/**
|
|
1542
|
+
* Opacity of the polygon. This is can be a constant opacity in [0, 1] or a definition based on zoom levels
|
|
1543
|
+
* Default: `1`
|
|
1544
|
+
*/
|
|
1545
|
+
fillOpacity?: ZoomNumberValues;
|
|
1546
|
+
/**
|
|
1547
|
+
* Position of the outline with regard to the polygon edge (when `.outline` is `true`)
|
|
1548
|
+
* Default: `"center"`
|
|
1549
|
+
*/
|
|
1550
|
+
outlinePosition: "center" | "inside" | "outside";
|
|
1551
|
+
/**
|
|
1552
|
+
* Sequence of line and void to create a dash pattern. The unit is the line width so that
|
|
1553
|
+
* a dash array value of `[3, 1]` will create a segment worth 3 times the width of the line,
|
|
1554
|
+
* followed by a spacing worth 1 time the line width, and then repeat.
|
|
1555
|
+
*
|
|
1556
|
+
* Alternatively, this property can be a string made of underscore and whitespace characters
|
|
1557
|
+
* such as `"___ _ "` and internaly this will be translated into [3, 1, 1, 1]. Note that
|
|
1558
|
+
* this way of describing dash arrays with a string only works for integer values.
|
|
1559
|
+
*
|
|
1560
|
+
* Dash arrays can contain more than 2 element to create more complex patters. For instance
|
|
1561
|
+
* a dash array value of [3, 2, 1, 2] will create the following sequence:
|
|
1562
|
+
* - a segment worth 3 times the width
|
|
1563
|
+
* - a spacing worth 2 times the width
|
|
1564
|
+
* - a segment worth 1 times the width
|
|
1565
|
+
* - a spacing worth 2 times the width
|
|
1566
|
+
* - repeat
|
|
1567
|
+
*
|
|
1568
|
+
* Default: no dash pattern
|
|
1569
|
+
*/
|
|
1570
|
+
outlineDashArray?: Array<number> | string;
|
|
1571
|
+
/**
|
|
1572
|
+
* The display of line endings for both the line and the outline (if `.outline` is `true`)
|
|
1573
|
+
* - "butt": A cap with a squared-off end which is drawn to the exact endpoint of the line.
|
|
1574
|
+
* - "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.
|
|
1575
|
+
* - "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.
|
|
1576
|
+
* Default: "round"
|
|
1577
|
+
*/
|
|
1578
|
+
outlineCap?: "butt" | "round" | "square";
|
|
1579
|
+
/**
|
|
1580
|
+
* The display of lines when joining for both the line and the outline (if `.outline` is `true`)
|
|
1581
|
+
* - "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.
|
|
1582
|
+
* - "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.
|
|
1583
|
+
* - "miter": A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet.
|
|
1584
|
+
* Default: "round"
|
|
1585
|
+
*/
|
|
1586
|
+
outlineJoin?: "bevel" | "round" | "miter";
|
|
1587
|
+
/**
|
|
1588
|
+
* The pattern is an image URL to be put as a repeated background pattern of the polygon.
|
|
1589
|
+
* Default: `null` (no pattern, `fillColor` will be used)
|
|
1590
|
+
*/
|
|
1591
|
+
pattern?: string | null;
|
|
1592
|
+
/**
|
|
1593
|
+
* How blury the outline is, with `0` being no blur and `10` and beyond being quite blurry.
|
|
1594
|
+
* Applies only if `.outline` is `true`.
|
|
1595
|
+
* Default: `0`
|
|
1596
|
+
*/
|
|
1597
|
+
outlineBlur?: number | ZoomNumberValues;
|
|
1598
|
+
};
|
|
1599
|
+
type PointLayerOptions = CommonShapeLayerOptions & {
|
|
1600
|
+
/**
|
|
1601
|
+
* Can be a unique point color as a string (CSS color such as "#FF0000" or "red").
|
|
1602
|
+
* Alternatively, the color can be a ColorRamp with a range.
|
|
1603
|
+
* In case of `.cluster` being `true`, the range of the ColorRamp will be addressed with the number of elements in
|
|
1604
|
+
* the cluster. If `.cluster` is `false`, the color will be addressed using the value of the `.property`.
|
|
1605
|
+
* If no `.property` is given but `.pointColor` is a ColorRamp, the chosen color is the one at the lower bound of the ColorRamp.
|
|
1606
|
+
* Default: a color randomly pick from a list
|
|
1607
|
+
*/
|
|
1608
|
+
pointColor?: string | ColorRamp;
|
|
1609
|
+
/**
|
|
1610
|
+
* Radius of the points. Can be a fixed size or a value dependant on the zoom.
|
|
1611
|
+
* If `.pointRadius` is not provided, the radius will depend on the size of each cluster (if `.cluster` is `true`)
|
|
1612
|
+
* or on the value of each point (if `.property` is provided and `.pointColor` is a ColorRamp).
|
|
1613
|
+
* The radius will be between `.minPointRadius` and `.maxPointRadius`
|
|
1614
|
+
*/
|
|
1615
|
+
pointRadius?: number | ZoomNumberValues;
|
|
1616
|
+
/**
|
|
1617
|
+
* The minimum point radius posible.
|
|
1618
|
+
* Default: `10`
|
|
1619
|
+
*/
|
|
1620
|
+
minPointRadius?: number;
|
|
1621
|
+
/**
|
|
1622
|
+
* The maximum point radius posible.
|
|
1623
|
+
* Default: `40`
|
|
1624
|
+
*/
|
|
1625
|
+
maxPointRadius?: number;
|
|
1626
|
+
/**
|
|
1627
|
+
* The point property to observe and apply the radius and color upon.
|
|
1628
|
+
* This is ignored if `.cluster` is `true` as the observed value will be fiorced to being the number
|
|
1629
|
+
* of elements in each cluster.
|
|
1630
|
+
*
|
|
1631
|
+
* Default: none
|
|
1632
|
+
*/
|
|
1633
|
+
property?: string;
|
|
1634
|
+
/**
|
|
1635
|
+
* Opacity of the point or icon. This is can be a constant opacity in [0, 1] or a definition based on zoom levels.
|
|
1636
|
+
* Alternatively, if not provided but the `.pointColor` is a ColorRamp, the opacity will be extracted from tha alpha
|
|
1637
|
+
* component if present.
|
|
1638
|
+
* Default: `1`
|
|
1639
|
+
*/
|
|
1640
|
+
pointOpacity?: number | ZoomNumberValues;
|
|
1641
|
+
/**
|
|
1642
|
+
* If `true`, the points will keep their circular shape align with the wiewport.
|
|
1643
|
+
* If `false`, the points will be like flatten on the map. This difference shows
|
|
1644
|
+
* when the map is tilted.
|
|
1645
|
+
* Default: `true`
|
|
1646
|
+
*/
|
|
1647
|
+
alignOnViewport?: boolean;
|
|
1648
|
+
/**
|
|
1649
|
+
* Whether the points should cluster
|
|
1650
|
+
*/
|
|
1651
|
+
cluster?: boolean;
|
|
1652
|
+
/**
|
|
1653
|
+
* Shows a label with the numerical value id `true`.
|
|
1654
|
+
* If `.cluster` is `true`, the value will be the numebr of elements in the cluster.
|
|
1655
|
+
*
|
|
1656
|
+
*
|
|
1657
|
+
* Default: `true` if `cluster` or `dataDrivenStyleProperty` are used, `false` otherwise.
|
|
1658
|
+
*/
|
|
1659
|
+
showLabel?: boolean;
|
|
1660
|
+
/**
|
|
1661
|
+
* text color used for the number elements in each cluster.
|
|
1662
|
+
* Applicable only when `cluster` is `true`.
|
|
1663
|
+
* Default: `#000000` (black)
|
|
1664
|
+
*/
|
|
1665
|
+
labelColor?: string;
|
|
1666
|
+
/**
|
|
1667
|
+
* text size used for the number elements in each cluster.
|
|
1668
|
+
* Applicable only when `cluster` is `true`.
|
|
1669
|
+
* Default: `12`
|
|
1670
|
+
*/
|
|
1671
|
+
labelSize?: number;
|
|
1672
|
+
/**
|
|
1673
|
+
* Only if `.cluster` is `false`.
|
|
1674
|
+
* If the radius is driven by a property, then it will also scale by zoomming if `.zoomCompensation` is `true`.
|
|
1675
|
+
* If `false`, the radius will not adapt according to the zoom level.
|
|
1676
|
+
* Default: `true`
|
|
1677
|
+
*/
|
|
1678
|
+
zoomCompensation?: boolean;
|
|
1679
|
+
};
|
|
1680
|
+
type HeatmapLayerOptions = {
|
|
1681
|
+
/**
|
|
1682
|
+
* ID to give to the layer.
|
|
1683
|
+
* If not provided, an auto-generated ID of the for "maptiler-layer-xxxxxx" will be auto-generated,
|
|
1684
|
+
* with "xxxxxx" being a random string.
|
|
1685
|
+
*/
|
|
1686
|
+
layerId?: string;
|
|
1687
|
+
/**
|
|
1688
|
+
* ID to give to the geojson source.
|
|
1689
|
+
* If not provided, an auto-generated ID of the for "maptiler-source-xxxxxx" will be auto-generated,
|
|
1690
|
+
* with "xxxxxx" being a random string.
|
|
1691
|
+
*/
|
|
1692
|
+
sourceId?: string;
|
|
1693
|
+
/**
|
|
1694
|
+
* A geojson Feature collection or a URL to a geojson or the UUID of a MapTiler Cloud dataset.
|
|
1695
|
+
*/
|
|
1696
|
+
data: FeatureCollection | string;
|
|
1697
|
+
/**
|
|
1698
|
+
* The ID of an existing layer to insert the new layer before, resulting in the new layer appearing
|
|
1699
|
+
* visually beneath the existing layer. If this argument is not specified, the layer will be appended
|
|
1700
|
+
* to the end of the layers array and appear visually above all other layers.
|
|
1701
|
+
*/
|
|
1702
|
+
beforeId?: string;
|
|
1703
|
+
/**
|
|
1704
|
+
* Zoom level at which it starts to show.
|
|
1705
|
+
* Default: `0`
|
|
1706
|
+
*/
|
|
1707
|
+
minzoom?: number;
|
|
1708
|
+
/**
|
|
1709
|
+
* Zoom level after which it no longer show.
|
|
1710
|
+
* Default: `22`
|
|
1711
|
+
*/
|
|
1712
|
+
maxzoom?: number;
|
|
1713
|
+
/**
|
|
1714
|
+
* The ColorRamp instance to use for visualization. The color ramp is expected to be defined in the
|
|
1715
|
+
* range `[0, 1]` or else will be forced to this range.
|
|
1716
|
+
* Default: `ColorRampCollection.TURBO`
|
|
1717
|
+
*/
|
|
1718
|
+
colorRamp?: ColorRamp;
|
|
1719
|
+
/**
|
|
1720
|
+
* Use a property to apply a weight to each data point. Using a property requires also using
|
|
1721
|
+
* the options `.propertyValueWeight` or otherwise will be ignored.
|
|
1722
|
+
* Default: none, the points will all have a weight of `1`.
|
|
1723
|
+
*/
|
|
1724
|
+
property?: string;
|
|
1725
|
+
/**
|
|
1726
|
+
* The weight to give to each data point. If of type `PropertyValueWeights`, then the options `.property`
|
|
1727
|
+
* must also be provided. If used a number, all data points will be weighted by the same number (which is of little interest)
|
|
1728
|
+
*/
|
|
1729
|
+
weight?: PropertyValues | number;
|
|
1730
|
+
/**
|
|
1731
|
+
* The radius (in screenspace) can be:
|
|
1732
|
+
* - a fixed number that will be constant across zoom level
|
|
1733
|
+
* - of type `ZoomNumberValues` to be ramped accoding to zoom level (`.zoomCompensation` will then be ignored)
|
|
1734
|
+
* - of type `PropertyValues` to be driven by the value of a property.
|
|
1735
|
+
* If so, the option `.property` must be provided and will still be resized according to zoom level,
|
|
1736
|
+
* unless the option `.zoomCompensation` is set to `false`.
|
|
1737
|
+
*
|
|
1738
|
+
* Default:
|
|
1739
|
+
*/
|
|
1740
|
+
radius?: number | ZoomNumberValues | PropertyValues;
|
|
1741
|
+
/**
|
|
1742
|
+
* The opacity can be a fixed value or zoom-driven.
|
|
1743
|
+
* Default: fades-in 0.25z after minzoom and fade-out 0.25z before maxzoom
|
|
1744
|
+
*/
|
|
1745
|
+
opacity?: number | ZoomNumberValues;
|
|
1746
|
+
/**
|
|
1747
|
+
* The intensity is zoom-dependent. By default, the intensity is going to be scaled by zoom to preserve
|
|
1748
|
+
* a natural aspect or the data distribution.
|
|
1749
|
+
*/
|
|
1750
|
+
intensity?: number | ZoomNumberValues;
|
|
1751
|
+
/**
|
|
1752
|
+
* If the radius is driven by a property, then it will also scale by zoomming if `.zoomCompensation` is `true`.
|
|
1753
|
+
* If `false`, the radius will not adapt according to the zoom level.
|
|
1754
|
+
* Default: `true`
|
|
1755
|
+
*/
|
|
1756
|
+
zoomCompensation?: boolean;
|
|
1757
|
+
};
|
|
1758
|
+
/**
|
|
1759
|
+
* Add a polyline to the map from various sources and with builtin styling.
|
|
1760
|
+
* Compatible sources:
|
|
1761
|
+
* - gpx content as string
|
|
1762
|
+
* - gpx file from URL
|
|
1763
|
+
* - kml content from string
|
|
1764
|
+
* - kml from url
|
|
1765
|
+
* - geojson from url
|
|
1766
|
+
* - geojson content as string
|
|
1767
|
+
* - geojson content as JS object
|
|
1768
|
+
* - uuid of a MapTiler Cloud dataset
|
|
1769
|
+
*
|
|
1770
|
+
* The method also gives the possibility to add an outline layer (if `options.outline` is `true`)
|
|
1771
|
+
* and if so , the returned property `polylineOutlineLayerId` will be a string. As a result, two layers
|
|
1772
|
+
* would be added.
|
|
1773
|
+
*
|
|
1774
|
+
* The default styling creates a line layer of constant width of 3px, the color will be randomly picked
|
|
1775
|
+
* from a curated list of colors and the opacity will be 1.
|
|
1776
|
+
* If the outline is enabled, the outline width is of 1px at all zoom levels, the color is white and
|
|
1777
|
+
* the opacity is 1.
|
|
1778
|
+
*
|
|
1779
|
+
* Those style properties can be changed and ramped according to zoom level using an easier syntax.
|
|
1780
|
+
*
|
|
1781
|
+
*/
|
|
1782
|
+
declare function addPolyline(
|
|
1783
|
+
/**
|
|
1784
|
+
* Map instance to add a polyline layer to
|
|
1785
|
+
*/
|
|
1786
|
+
map: Map,
|
|
1787
|
+
/**
|
|
1788
|
+
* Options related to adding a polyline layer
|
|
1789
|
+
*/
|
|
1790
|
+
options: PolylineLayerOptions,
|
|
1791
|
+
/**
|
|
1792
|
+
* When the polyline data is loaded from a distant source, these options are propagated to the call of `fetch`
|
|
1793
|
+
*/
|
|
1794
|
+
fetchOptions?: RequestInit): Promise<{
|
|
1795
|
+
polylineLayerId: string;
|
|
1796
|
+
polylineOutlineLayerId: string;
|
|
1797
|
+
polylineSourceId: string;
|
|
1798
|
+
}>;
|
|
1799
|
+
/**
|
|
1800
|
+
* Add a polygon with styling options.
|
|
1801
|
+
*/
|
|
1802
|
+
declare function addPolygon(map: Map, options: PolygonLayerOptions): {
|
|
1803
|
+
/**
|
|
1804
|
+
* ID of the fill layer
|
|
1805
|
+
*/
|
|
1806
|
+
polygonLayerId: string;
|
|
1807
|
+
/**
|
|
1808
|
+
* ID of the outline layer (will be `""` if no outline)
|
|
1809
|
+
*/
|
|
1810
|
+
polygonOutlineLayerId: string;
|
|
1811
|
+
/**
|
|
1812
|
+
* ID of the source that contains the data
|
|
1813
|
+
*/
|
|
1814
|
+
polygonSourceId: string;
|
|
1815
|
+
};
|
|
1816
|
+
/**
|
|
1817
|
+
* Add a point layer from a GeoJSON source (or an existing sourceId) with many styling options
|
|
1818
|
+
*/
|
|
1819
|
+
declare function addPoint(
|
|
1820
|
+
/**
|
|
1821
|
+
* The Map instance to add a point layer to
|
|
1822
|
+
*/
|
|
1823
|
+
map: Map, options: PointLayerOptions): {
|
|
1824
|
+
/**
|
|
1825
|
+
* ID of the unclustered point layer
|
|
1826
|
+
*/
|
|
1827
|
+
pointLayerId: string;
|
|
1828
|
+
/**
|
|
1829
|
+
* ID of the clustered point layer (empty if `cluster` options id `false`)
|
|
1830
|
+
*/
|
|
1831
|
+
clusterLayerId: string;
|
|
1832
|
+
/**
|
|
1833
|
+
* ID of the layer that shows the count of elements in each cluster (empty if `cluster` options id `false`)
|
|
1834
|
+
*/
|
|
1835
|
+
labelLayerId: string;
|
|
1836
|
+
/**
|
|
1837
|
+
* ID of the data source
|
|
1838
|
+
*/
|
|
1839
|
+
pointSourceId: string;
|
|
1840
|
+
};
|
|
1841
|
+
/**
|
|
1842
|
+
* Add a polyline witgh optional outline from a GeoJSON object
|
|
1843
|
+
*/
|
|
1844
|
+
declare function addHeatmap(
|
|
1845
|
+
/**
|
|
1846
|
+
* Map instance to add a heatmap layer to
|
|
1847
|
+
*/
|
|
1848
|
+
map: Map, options: HeatmapLayerOptions): {
|
|
1849
|
+
/**
|
|
1850
|
+
* ID of the heatmap layer
|
|
1851
|
+
*/
|
|
1852
|
+
heatmapLayerId: string;
|
|
1853
|
+
/**
|
|
1854
|
+
* ID of the data source
|
|
1855
|
+
*/
|
|
1856
|
+
heatmapSourceId: string;
|
|
1857
|
+
};
|
|
1858
|
+
|
|
1859
|
+
/**
|
|
1860
|
+
* Helpers are a set of functions to facilitate the creation of sources and layers
|
|
1861
|
+
*/
|
|
1862
|
+
declare const helpers: {
|
|
1863
|
+
addPolyline: typeof addPolyline;
|
|
1864
|
+
addPolygon: typeof addPolygon;
|
|
1865
|
+
addPoint: typeof addPoint;
|
|
1866
|
+
addHeatmap: typeof addHeatmap;
|
|
1867
|
+
};
|
|
1868
|
+
|
|
1869
|
+
declare const setRTLTextPlugin: (url: string, callback: (error?: Error | undefined) => void, deferred?: boolean | undefined) => void;
|
|
786
1870
|
declare const getRTLTextPluginStatus: () => string;
|
|
787
1871
|
declare const prewarm: () => void;
|
|
788
1872
|
declare const clearPrewarmedResources: () => void;
|
|
@@ -790,8 +1874,8 @@ declare const version: string;
|
|
|
790
1874
|
declare const workerCount: number;
|
|
791
1875
|
declare const maxParallelImageRequests: number;
|
|
792
1876
|
declare const workerUrl: string;
|
|
793
|
-
declare const addProtocol:
|
|
794
|
-
declare const removeProtocol:
|
|
1877
|
+
declare const addProtocol: typeof maplibre_gl__default.addProtocol;
|
|
1878
|
+
declare const removeProtocol: typeof maplibre_gl__default.removeProtocol;
|
|
795
1879
|
|
|
796
1880
|
declare const NavigationControlMLGL: typeof maplibre_gl.NavigationControl;
|
|
797
1881
|
type NavigationControlMLGL = InstanceType<typeof NavigationControlMLGL>;
|
|
@@ -840,4 +1924,4 @@ type VideoSourceMLGL = InstanceType<typeof VideoSourceMLGL>;
|
|
|
840
1924
|
declare const MapMLGL: typeof maplibre_gl.Map;
|
|
841
1925
|
type MapMLGL = InstanceType<typeof MapMLGL>;
|
|
842
1926
|
|
|
843
|
-
export { AJAXError, AttributionControl, AttributionControlMLGL, CanvasSource, CanvasSourceMLGL, Evented, FullscreenControl, FullscreenControlMLGL, GeoJSONSource, GeoJSONSourceMLGL, GeolocateControl, GeolocateControlMLGL, GeolocationType, ImageSource, ImageSourceMLGL, Language, LanguageKey, LanguageString, LngLat, LngLatBounds, LoadWithTerrainEvent, LogoControl, LogoControlMLGL, Map, MapMLGL, MapOptions, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerNavigationControl, MaptilerTerrainControl, Marker, MarkerMLGL, Matrix2, MercatorCoordinate, NavigationControl, NavigationControlMLGL, Point, Popup, PopupMLGL, RasterDEMTileSource, RasterDEMTileSourceMLGL, RasterTileSource, RasterTileSourceMLGL, ScaleControl, ScaleControlMLGL, SdkConfig, Style, StyleMLGL, TerrainControl, TerrainControlMLGL, Unit, VectorTileSource, VectorTileSourceMLGL, VideoSource, VideoSourceMLGL, addProtocol, clearPrewarmedResources, config, getRTLTextPluginStatus, maxParallelImageRequests, prewarm, removeProtocol, setRTLTextPlugin, version, workerCount, workerUrl };
|
|
1927
|
+
export { AJAXError, ArrayColor, ArrayColorRamp, ArrayColorRampStop, AttributionControl, AttributionControlMLGL, CanvasSource, CanvasSourceMLGL, ColorRamp, ColorRampCollection, ColorRampOptions, ColorStop, CommonShapeLayerOptions, Evented, FullscreenControl, FullscreenControlMLGL, GeoJSONSource, GeoJSONSourceMLGL, GeolocateControl, GeolocateControlMLGL, GeolocationType, HeatmapLayerOptions, ImageSource, ImageSourceMLGL, Language, LanguageKey, LanguageString, Link, LngLat, LngLatBounds, LoadWithTerrainEvent, LogoControl, LogoControlMLGL, Map, MapMLGL, MapOptions, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerNavigationControl, MaptilerTerrainControl, Marker, MarkerMLGL, Matrix2, MercatorCoordinate, MinimapOptionsInput, NavigationControl, NavigationControlMLGL, PlacemarkProperties, Point, PointLayerOptions, PolygonLayerOptions, PolylineLayerOptions, Popup, PopupMLGL, PropertyValues, RasterDEMTileSource, RasterDEMTileSourceMLGL, RasterTileSource, RasterTileSourceMLGL, RgbaColor, ScaleControl, ScaleControlMLGL, SdkConfig, Style, StyleMLGL, TerrainControl, TerrainControlMLGL, Unit, VectorTileSource, VectorTileSourceMLGL, VideoSource, VideoSourceMLGL, XMLProperties, ZoomNumberValues, ZoomStringValues, addProtocol, clearPrewarmedResources, config, getRTLTextPluginStatus, gpx, gpxOrKml, hasChildNodeWithName, helpers, kml, maxParallelImageRequests, prewarm, removeProtocol, setRTLTextPlugin, str2xml, version, workerCount, workerUrl, xml2str };
|