@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.
- package/biome.json +2 -1
- package/dist/maptiler-sdk.css +0 -1
- package/dist/maptiler-sdk.d.ts +1 -1785
- package/dist/maptiler-sdk.mjs +1782 -2617
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/src/MLAdapters/AttributionControl.d.ts +6 -0
- package/dist/src/MLAdapters/BoxZoomHandler.d.ts +8 -0
- package/dist/src/MLAdapters/CanvasSource.d.ts +6 -0
- package/dist/src/MLAdapters/CooperativeGesturesHandler.d.ts +6 -0
- package/dist/src/MLAdapters/FullscreenControl.d.ts +6 -0
- package/dist/src/MLAdapters/GeoJSONSource.d.ts +6 -0
- package/dist/src/MLAdapters/GeolocateControl.d.ts +6 -0
- package/dist/src/MLAdapters/ImageSource.d.ts +6 -0
- package/dist/src/MLAdapters/KeyboardHandler.d.ts +6 -0
- package/dist/src/MLAdapters/LogoControl.d.ts +6 -0
- package/dist/src/MLAdapters/MapMouseEvent.d.ts +6 -0
- package/dist/src/MLAdapters/MapTouchEvent.d.ts +6 -0
- package/dist/src/MLAdapters/MapWheelEvent.d.ts +6 -0
- package/dist/src/MLAdapters/Marker.d.ts +6 -0
- package/dist/src/MLAdapters/NavigationControl.d.ts +6 -0
- package/dist/src/MLAdapters/Popup.d.ts +6 -0
- package/dist/src/MLAdapters/RasterDEMTileSource.d.ts +6 -0
- package/dist/src/MLAdapters/RasterTileSource.d.ts +6 -0
- package/dist/src/MLAdapters/ScaleControl.d.ts +6 -0
- package/dist/src/MLAdapters/ScrollZoomHandler.d.ts +6 -0
- package/dist/src/MLAdapters/Style.d.ts +6 -0
- package/dist/src/MLAdapters/TerrainControl.d.ts +6 -0
- package/dist/src/MLAdapters/TwoFingersTouchPitchHandler.d.ts +6 -0
- package/dist/src/MLAdapters/VectorTileSource.d.ts +6 -0
- package/dist/src/MLAdapters/VideoSource.d.ts +6 -0
- package/dist/src/Map.d.ts +349 -0
- package/dist/src/MaptilerGeolocateControl.d.ts +21 -0
- package/dist/src/MaptilerLogoControl.d.ts +20 -0
- package/dist/src/MaptilerNavigationControl.d.ts +18 -0
- package/dist/src/MaptilerTerrainControl.d.ts +17 -0
- package/dist/src/Minimap.d.ts +58 -0
- package/dist/src/Point.d.ts +177 -0
- package/dist/src/caching.d.ts +5 -0
- package/dist/src/colorramp.d.ts +359 -0
- package/dist/src/config.d.ts +68 -0
- package/dist/src/converters/index.d.ts +1 -0
- package/dist/src/converters/xml.d.ts +54 -0
- package/dist/src/defaults.d.ts +14 -0
- package/dist/src/helpers/index.d.ts +14 -0
- package/dist/src/helpers/screenshot.d.ts +19 -0
- package/dist/src/helpers/stylehelper.d.ts +29 -0
- package/dist/src/helpers/vectorlayerhelpers.d.ts +509 -0
- package/dist/src/index.d.ts +89 -0
- package/dist/src/language.d.ts +108 -0
- package/dist/src/mapstyle.d.ts +3 -0
- package/dist/src/tools.d.ts +46 -0
- package/dist/src/unit.d.ts +1 -0
- package/package.json +15 -21
- package/readme.md +31 -0
- package/tsconfig.json +21 -8
- package/vite.config-es.ts +48 -0
- package/vite.config-umd.ts +27 -0
- package/.github/pull_request_template.md +0 -11
- package/.github/workflows/format-lint.yml +0 -21
- package/.github/workflows/npm-publish.yml +0 -22
- package/dist/maptiler-sdk.min.mjs +0 -3
- package/rollup.config.js +0 -147
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
|
|
2
|
+
import { Map as SDKMap } from '../Map';
|
|
3
|
+
|
|
4
|
+
export declare class BoxZoomHandler extends maplibregl.BoxZoomHandler {
|
|
5
|
+
constructor(map: SDKMap | MapMLGL, options: {
|
|
6
|
+
clickTolerance: number;
|
|
7
|
+
});
|
|
8
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as maplibregl, GestureOptions, Map as MapMLGL } from 'maplibre-gl';
|
|
2
|
+
import { Map as SDKMap } from '../Map';
|
|
3
|
+
|
|
4
|
+
export declare class CooperativeGesturesHandler extends maplibregl.CooperativeGesturesHandler {
|
|
5
|
+
constructor(map: SDKMap | MapMLGL, options: GestureOptions);
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
|
|
2
|
+
import { Map as SDKMap } from '../Map';
|
|
3
|
+
|
|
4
|
+
export declare class MapMouseEvent extends maplibregl.MapMouseEvent {
|
|
5
|
+
constructor(type: string, map: SDKMap | MapMLGL, originalEvent: MouseEvent, data?: any);
|
|
6
|
+
}
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { default as maplibregl, StyleSpecification, MapOptions as MapOptionsML, ControlPosition, StyleSwapOptions, StyleOptions, RequestTransformFunction, LayerSpecification, SourceSpecification, CustomLayerInterface, FilterSpecification, StyleSetterOptions } from 'maplibre-gl';
|
|
2
|
+
import { ReferenceMapStyle, MapStyleVariant } from '@maptiler/client';
|
|
3
|
+
import { SdkConfig } from './config';
|
|
4
|
+
import { LanguageInfo } from './language';
|
|
5
|
+
import { MinimapOptionsInput } from './Minimap';
|
|
6
|
+
|
|
7
|
+
export type LoadWithTerrainEvent = {
|
|
8
|
+
type: "loadWithTerrain";
|
|
9
|
+
target: Map;
|
|
10
|
+
terrain: {
|
|
11
|
+
source: string;
|
|
12
|
+
exaggeration: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare const GeolocationType: {
|
|
16
|
+
POINT: "POINT";
|
|
17
|
+
COUNTRY: "COUNTRY";
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Options to provide to the `Map` constructor
|
|
21
|
+
*/
|
|
22
|
+
export type MapOptions = Omit<MapOptionsML, "style" | "maplibreLogo"> & {
|
|
23
|
+
/**
|
|
24
|
+
* Style of the map. Can be:
|
|
25
|
+
* - a full style URL (possibly with API key)
|
|
26
|
+
* - a shorthand with only the MapTIler style name (eg. `"streets-v2"`)
|
|
27
|
+
* - a longer form with the prefix `"maptiler://"` (eg. `"maptiler://streets-v2"`)
|
|
28
|
+
*/
|
|
29
|
+
style?: ReferenceMapStyle | MapStyleVariant | StyleSpecification | string;
|
|
30
|
+
/**
|
|
31
|
+
* Define the language of the map. This can be done directly with a language ISO code (eg. "en")
|
|
32
|
+
* or with a built-in shorthand (eg. Language.ENGLISH).
|
|
33
|
+
* Note that this is equivalent to setting the `config.primaryLanguage` and will overwrite it.
|
|
34
|
+
*/
|
|
35
|
+
language?: LanguageInfo;
|
|
36
|
+
/**
|
|
37
|
+
* Define the MapTiler Cloud API key to be used. This is strictly equivalent to setting
|
|
38
|
+
* `config.apiKey` and will overwrite it.
|
|
39
|
+
*/
|
|
40
|
+
apiKey?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Shows or hides the MapTiler logo in the bottom left corner.
|
|
43
|
+
*
|
|
44
|
+
* For paid plans:
|
|
45
|
+
* - `true` shows MapTiler logo
|
|
46
|
+
* - `false` hodes MapTiler logo
|
|
47
|
+
* - default: `false` (hide)
|
|
48
|
+
*
|
|
49
|
+
* For free plans: MapTiler logo always shows, regardless of the value.
|
|
50
|
+
*/
|
|
51
|
+
maptilerLogo?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Attribution text to show in an {@link AttributionControl}.
|
|
54
|
+
*/
|
|
55
|
+
customAttribution?: string | Array<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Enables 3D terrain if `true`. (default: `false`)
|
|
58
|
+
*/
|
|
59
|
+
terrain?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Exaggeration factor of the terrain. (default: `1`, no exaggeration)
|
|
62
|
+
*/
|
|
63
|
+
terrainExaggeration?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Show the navigation control. (default: `true`, will hide if `false`)
|
|
66
|
+
*/
|
|
67
|
+
navigationControl?: boolean | ControlPosition;
|
|
68
|
+
/**
|
|
69
|
+
* Show the terrain control. (default: `false`, will show if `true`)
|
|
70
|
+
*/
|
|
71
|
+
terrainControl?: boolean | ControlPosition;
|
|
72
|
+
/**
|
|
73
|
+
* Show the geolocate control. (default: `true`, will hide if `false`)
|
|
74
|
+
*/
|
|
75
|
+
geolocateControl?: boolean | ControlPosition;
|
|
76
|
+
/**
|
|
77
|
+
* Show the scale control. (default: `false`, will show if `true`)
|
|
78
|
+
*/
|
|
79
|
+
scaleControl?: boolean | ControlPosition;
|
|
80
|
+
/**
|
|
81
|
+
* Show the full screen control. (default: `false`, will show if `true`)
|
|
82
|
+
*/
|
|
83
|
+
fullscreenControl?: boolean | ControlPosition;
|
|
84
|
+
/**
|
|
85
|
+
* Display a minimap in a user defined corner of the map. (default: `bottom-left` corner)
|
|
86
|
+
* If set to true, the map will assume it is a minimap and forego the attribution control.
|
|
87
|
+
*/
|
|
88
|
+
minimap?: boolean | ControlPosition | MinimapOptionsInput;
|
|
89
|
+
/**
|
|
90
|
+
* attributionControl
|
|
91
|
+
*/
|
|
92
|
+
forceNoAttributionControl?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Method to position the map at a given geolocation. Only if:
|
|
95
|
+
* - `hash` is `false`
|
|
96
|
+
* - `center` is not provided
|
|
97
|
+
*
|
|
98
|
+
* If the value is `true` of `"POINT"` (given by `GeolocationType.POINT`) then the positionning uses the MapTiler Cloud
|
|
99
|
+
* Geolocation to find the non-GPS location point.
|
|
100
|
+
* The zoom level can be provided in the `Map` constructor with the `zoom` option or will be `13` if not provided.
|
|
101
|
+
*
|
|
102
|
+
* If the value is `"COUNTRY"` (given by `GeolocationType.COUNTRY`) then the map is centered around the bounding box of the country.
|
|
103
|
+
* In this case, the `zoom` option will be ignored.
|
|
104
|
+
*
|
|
105
|
+
* If the value is `false`, no geolocation is performed and the map centering and zooming depends on other options or on
|
|
106
|
+
* the built-in defaults.
|
|
107
|
+
*
|
|
108
|
+
* If this option is non-false and the options `center` is also provided, then `center` prevails.
|
|
109
|
+
*
|
|
110
|
+
* Default: `false`
|
|
111
|
+
*/
|
|
112
|
+
geolocate?: (typeof GeolocationType)[keyof typeof GeolocationType] | boolean;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* The Map class can be instanciated to display a map in a `<div>`
|
|
116
|
+
*/
|
|
117
|
+
export declare class Map extends maplibregl.Map {
|
|
118
|
+
private isTerrainEnabled;
|
|
119
|
+
private terrainExaggeration;
|
|
120
|
+
private primaryLanguage;
|
|
121
|
+
private terrainGrowing;
|
|
122
|
+
private terrainFlattening;
|
|
123
|
+
private minimap?;
|
|
124
|
+
private forceLanguageUpdate;
|
|
125
|
+
private languageAlwaysBeenStyle;
|
|
126
|
+
private isReady;
|
|
127
|
+
constructor(options: MapOptions);
|
|
128
|
+
/**
|
|
129
|
+
* Awaits for _this_ Map instance to be "loaded" and returns a Promise to the Map.
|
|
130
|
+
* If _this_ Map instance is already loaded, the Promise is resolved directly,
|
|
131
|
+
* otherwise, it is resolved as a result of the "load" event.
|
|
132
|
+
* @returns
|
|
133
|
+
*/
|
|
134
|
+
onLoadAsync(): Promise<Map>;
|
|
135
|
+
/**
|
|
136
|
+
* Awaits for _this_ Map instance to be "ready" and returns a Promise to the Map.
|
|
137
|
+
* If _this_ Map instance is already ready, the Promise is resolved directly,
|
|
138
|
+
* otherwise, it is resolved as a result of the "ready" event.
|
|
139
|
+
* A map instance is "ready" when all the controls that can be managed by the contructor are
|
|
140
|
+
* dealt with. This happens after the "load" event, due to the asynchronous nature
|
|
141
|
+
* of some built-in controls.
|
|
142
|
+
*/
|
|
143
|
+
onReadyAsync(): Promise<Map>;
|
|
144
|
+
/**
|
|
145
|
+
* Awaits for _this_ Map instance to be "loaded" as well as with terrain being non-null for the first time
|
|
146
|
+
* and returns a Promise to the Map.
|
|
147
|
+
* If _this_ Map instance is already loaded with terrain, the Promise is resolved directly,
|
|
148
|
+
* otherwise, it is resolved as a result of the "loadWithTerrain" event.
|
|
149
|
+
* @returns
|
|
150
|
+
*/
|
|
151
|
+
onLoadWithTerrainAsync(): Promise<Map>;
|
|
152
|
+
/**
|
|
153
|
+
* Update the style of the map.
|
|
154
|
+
* Can be:
|
|
155
|
+
* - a full style URL (possibly with API key)
|
|
156
|
+
* - a shorthand with only the MapTIler style name (eg. `"streets-v2"`)
|
|
157
|
+
* - a longer form with the prefix `"maptiler://"` (eg. `"maptiler://streets-v2"`)
|
|
158
|
+
*/
|
|
159
|
+
setStyle(style: null | ReferenceMapStyle | MapStyleVariant | StyleSpecification | string, options?: StyleSwapOptions & StyleOptions): this;
|
|
160
|
+
/**
|
|
161
|
+
* Adds a [MapLibre style layer](https://maplibre.org/maplibre-style-spec/layers)
|
|
162
|
+
* to the map's style.
|
|
163
|
+
*
|
|
164
|
+
* A layer defines how data from a specified source will be styled. Read more about layer types
|
|
165
|
+
* and available paint and layout properties in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/layers).
|
|
166
|
+
*
|
|
167
|
+
* @param layer - The layer to add,
|
|
168
|
+
* conforming to either the MapLibre Style Specification's [layer definition](https://maplibre.org/maplibre-style-spec/layers) or,
|
|
169
|
+
* less commonly, the {@link CustomLayerInterface} specification.
|
|
170
|
+
* The MapLibre Style Specification's layer definition is appropriate for most layers.
|
|
171
|
+
*
|
|
172
|
+
* @param beforeId - The ID of an existing layer to insert the new layer before,
|
|
173
|
+
* resulting in the new layer appearing visually beneath the existing layer.
|
|
174
|
+
* If this argument is not specified, the layer will be appended to the end of the layers array
|
|
175
|
+
* and appear visually above all other layers.
|
|
176
|
+
*
|
|
177
|
+
* @returns `this`
|
|
178
|
+
*/
|
|
179
|
+
addLayer(layer: (LayerSpecification & {
|
|
180
|
+
source?: string | SourceSpecification;
|
|
181
|
+
}) | CustomLayerInterface, beforeId?: string): this;
|
|
182
|
+
/**
|
|
183
|
+
* Moves a layer to a different z-position.
|
|
184
|
+
*
|
|
185
|
+
* @param id - The ID of the layer to move.
|
|
186
|
+
* @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.
|
|
187
|
+
* @returns `this`
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* 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.
|
|
191
|
+
* ```ts
|
|
192
|
+
* map.moveLayer('polygon', 'country-label');
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
moveLayer(id: string, beforeId?: string): this;
|
|
196
|
+
/**
|
|
197
|
+
* Removes the layer with the given ID from the map's style.
|
|
198
|
+
*
|
|
199
|
+
* An {@link ErrorEvent} will be fired if the image parameter is invald.
|
|
200
|
+
*
|
|
201
|
+
* @param id - The ID of the layer to remove
|
|
202
|
+
* @returns `this`
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* If a layer with ID 'state-data' exists, remove it.
|
|
206
|
+
* ```ts
|
|
207
|
+
* if (map.getLayer('state-data')) map.removeLayer('state-data');
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
removeLayer(id: string): this;
|
|
211
|
+
/**
|
|
212
|
+
* Sets the zoom extent for the specified style layer. The zoom extent includes the
|
|
213
|
+
* [minimum zoom level](https://maplibre.org/maplibre-style-spec/layers/#minzoom)
|
|
214
|
+
* and [maximum zoom level](https://maplibre.org/maplibre-style-spec/layers/#maxzoom))
|
|
215
|
+
* at which the layer will be rendered.
|
|
216
|
+
*
|
|
217
|
+
* Note: For style layers using vector sources, style layers cannot be rendered at zoom levels lower than the
|
|
218
|
+
* minimum zoom level of the _source layer_ because the data does not exist at those zoom levels. If the minimum
|
|
219
|
+
* zoom level of the source layer is higher than the minimum zoom level defined in the style layer, the style
|
|
220
|
+
* layer will not be rendered at all zoom levels in the zoom range.
|
|
221
|
+
*/
|
|
222
|
+
setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this;
|
|
223
|
+
/**
|
|
224
|
+
* Sets the filter for the specified style layer.
|
|
225
|
+
*
|
|
226
|
+
* Filters control which features a style layer renders from its source.
|
|
227
|
+
* Any feature for which the filter expression evaluates to `true` will be
|
|
228
|
+
* rendered on the map. Those that are false will be hidden.
|
|
229
|
+
*
|
|
230
|
+
* Use `setFilter` to show a subset of your source data.
|
|
231
|
+
*
|
|
232
|
+
* To clear the filter, pass `null` or `undefined` as the second parameter.
|
|
233
|
+
*/
|
|
234
|
+
setFilter(layerId: string, filter?: FilterSpecification | null, options?: StyleSetterOptions): this;
|
|
235
|
+
/**
|
|
236
|
+
* Sets the value of a paint property in the specified style layer.
|
|
237
|
+
*
|
|
238
|
+
* @param layerId - The ID of the layer to set the paint property in.
|
|
239
|
+
* @param name - The name of the paint property to set.
|
|
240
|
+
* @param value - The value of the paint property to set.
|
|
241
|
+
* Must be of a type appropriate for the property, as defined in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/).
|
|
242
|
+
* @param options - Options object.
|
|
243
|
+
* @returns `this`
|
|
244
|
+
* @example
|
|
245
|
+
* ```ts
|
|
246
|
+
* map.setPaintProperty('my-layer', 'fill-color', '#faafee');
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
setPaintProperty(layerId: string, name: string, value: any, options?: StyleSetterOptions): this;
|
|
250
|
+
/**
|
|
251
|
+
* Sets the value of a layout property in the specified style layer.
|
|
252
|
+
* Layout properties define how the layer is styled.
|
|
253
|
+
* Layout properties for layers of the same type are documented together.
|
|
254
|
+
* Layers of different types have different layout properties.
|
|
255
|
+
* See the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/) for the complete list of layout properties.
|
|
256
|
+
* @param layerId - The ID of the layer to set the layout property in.
|
|
257
|
+
* @param name - The name of the layout property to set.
|
|
258
|
+
* @param value - The value of the layout property to set.
|
|
259
|
+
* Must be of a type appropriate for the property, as defined in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/).
|
|
260
|
+
* @param options - Options object.
|
|
261
|
+
* @returns `this`
|
|
262
|
+
*/
|
|
263
|
+
setLayoutProperty(layerId: string, name: string, value: any, options?: StyleSetterOptions): this;
|
|
264
|
+
/**
|
|
265
|
+
* Sets the value of the style's glyphs property.
|
|
266
|
+
*
|
|
267
|
+
* @param glyphsUrl - Glyph URL to set. Must conform to the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/glyphs/).
|
|
268
|
+
* @param options - Options object.
|
|
269
|
+
* @returns `this`
|
|
270
|
+
* @example
|
|
271
|
+
* ```ts
|
|
272
|
+
* map.setGlyphs('https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf');
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
setGlyphs(glyphsUrl: string | null, options?: StyleSetterOptions): this;
|
|
276
|
+
private getStyleLanguage;
|
|
277
|
+
/**
|
|
278
|
+
* Define the primary language of the map. Note that not all the languages shorthands provided are available.
|
|
279
|
+
*/
|
|
280
|
+
setLanguage(language: LanguageInfo | string): void;
|
|
281
|
+
/**
|
|
282
|
+
* Define the primary language of the map. Note that not all the languages shorthands provided are available.
|
|
283
|
+
*/
|
|
284
|
+
private setPrimaryLanguage;
|
|
285
|
+
/**
|
|
286
|
+
* Get the primary language
|
|
287
|
+
* @returns
|
|
288
|
+
*/
|
|
289
|
+
getPrimaryLanguage(): LanguageInfo;
|
|
290
|
+
/**
|
|
291
|
+
* Get the exaggeration factor applied to the terrain
|
|
292
|
+
* @returns
|
|
293
|
+
*/
|
|
294
|
+
getTerrainExaggeration(): number;
|
|
295
|
+
/**
|
|
296
|
+
* Know if terrian is enabled or not
|
|
297
|
+
* @returns
|
|
298
|
+
*/
|
|
299
|
+
hasTerrain(): boolean;
|
|
300
|
+
private growTerrain;
|
|
301
|
+
/**
|
|
302
|
+
* Enables the 3D terrain visualization
|
|
303
|
+
*/
|
|
304
|
+
enableTerrain(exaggeration?: number): void;
|
|
305
|
+
/**
|
|
306
|
+
* Disable the 3D terrain visualization
|
|
307
|
+
*/
|
|
308
|
+
disableTerrain(): void;
|
|
309
|
+
/**
|
|
310
|
+
* Sets the 3D terrain exageration factor.
|
|
311
|
+
* If the terrain was not enabled prior to the call of this method,
|
|
312
|
+
* the method `.enableTerrain()` will be called.
|
|
313
|
+
* If `animate` is `true`, the terrain transformation will be animated in the span of 1 second.
|
|
314
|
+
* If `animate` is `false`, no animated transition to the newly defined exaggeration.
|
|
315
|
+
*/
|
|
316
|
+
setTerrainExaggeration(exaggeration: number, animate?: boolean): void;
|
|
317
|
+
/**
|
|
318
|
+
* Perform an action when the style is ready. It could be at the moment of calling this method
|
|
319
|
+
* or later.
|
|
320
|
+
*/
|
|
321
|
+
private onStyleReady;
|
|
322
|
+
fitToIpBounds(): Promise<void>;
|
|
323
|
+
centerOnIpPoint(zoom: number | undefined): Promise<void>;
|
|
324
|
+
getCameraHash(): string;
|
|
325
|
+
/**
|
|
326
|
+
* Get the SDK config object.
|
|
327
|
+
* This is convenient to dispatch the SDK configuration to externally built layers
|
|
328
|
+
* that do not directly have access to the SDK configuration but do have access to a Map instance.
|
|
329
|
+
*/
|
|
330
|
+
getSdkConfig(): SdkConfig;
|
|
331
|
+
/**
|
|
332
|
+
* Get the MapTiler session ID. Convenient to dispatch to externaly built component
|
|
333
|
+
* that do not directly have access to the SDK configuration but do have access to a Map instance.
|
|
334
|
+
* @returns
|
|
335
|
+
*/
|
|
336
|
+
getMaptilerSessionId(): string;
|
|
337
|
+
/**
|
|
338
|
+
* Updates the requestManager's transform request with a new function.
|
|
339
|
+
*
|
|
340
|
+
* @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.
|
|
341
|
+
* Expected to return an object with a `url` property and optionally `headers` and `credentials` properties
|
|
342
|
+
*
|
|
343
|
+
* @returns {Map} `this`
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* map.setTransformRequest((url: string, resourceType: string) => {});
|
|
347
|
+
*/
|
|
348
|
+
setTransformRequest(transformRequest: RequestTransformFunction): this;
|
|
349
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GeolocateControl } from './MLAdapters/GeolocateControl';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The MaptilerGeolocateControl is an extension of the original GeolocateControl
|
|
5
|
+
* with a few changes. In this version, the active mode persists as long as the
|
|
6
|
+
* location is still centered. This means it's robust to rotation, pitch and zoom.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export declare class MaptilerGeolocateControl extends GeolocateControl {
|
|
10
|
+
private lastUpdatedCenter;
|
|
11
|
+
/**
|
|
12
|
+
* Update the camera location to center on the current position
|
|
13
|
+
*
|
|
14
|
+
* @param {Position} position the Geolocation API Position
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
_updateCamera: (position: GeolocationPosition) => void;
|
|
18
|
+
_finishSetupUI: (supported: boolean) => void;
|
|
19
|
+
_updateCircleRadius(): void;
|
|
20
|
+
_onZoom: () => void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LogoControlOptions as LogoControlOptionsML } from 'maplibre-gl';
|
|
2
|
+
import { LogoControl } from './MLAdapters/LogoControl';
|
|
3
|
+
import { Map as SDKMap } from './Map';
|
|
4
|
+
|
|
5
|
+
type LogoControlOptions = LogoControlOptionsML & {
|
|
6
|
+
logoURL?: string;
|
|
7
|
+
linkURL?: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* This LogoControl extends the MapLibre LogoControl but instead can use any image URL and
|
|
11
|
+
* any link URL. By default this is using MapTiler logo and URL.
|
|
12
|
+
*/
|
|
13
|
+
export declare class MaptilerLogoControl extends LogoControl {
|
|
14
|
+
_compact: boolean;
|
|
15
|
+
private logoURL;
|
|
16
|
+
private linkURL;
|
|
17
|
+
constructor(options?: LogoControlOptions);
|
|
18
|
+
onAdd(map: SDKMap): HTMLElement;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NavigationControlOptions } from 'maplibre-gl';
|
|
2
|
+
import { NavigationControl } from './MLAdapters/NavigationControl';
|
|
3
|
+
|
|
4
|
+
type HTMLButtonElementPlus = HTMLButtonElement & {
|
|
5
|
+
clickFunction: (e?: Event) => unknown;
|
|
6
|
+
};
|
|
7
|
+
export declare class MaptilerNavigationControl extends NavigationControl {
|
|
8
|
+
constructor(options?: NavigationControlOptions);
|
|
9
|
+
/**
|
|
10
|
+
* Overloading: the button now stores its click callback so that we can later on delete it and replace it
|
|
11
|
+
*/
|
|
12
|
+
_createButton(className: string, fn: (e?: Event) => unknown): HTMLButtonElementPlus;
|
|
13
|
+
/**
|
|
14
|
+
* Overloading: Limit how flat the compass icon can get
|
|
15
|
+
*/
|
|
16
|
+
_rotateCompassArrow: () => void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Map as SDKMap } from './Map';
|
|
2
|
+
import { IControl } from 'maplibre-gl';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A `MaptilerTerrainControl` control adds a button to turn terrain on and off
|
|
6
|
+
* by triggering the terrain logic that is already deployed in the Map object.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MaptilerTerrainControl implements IControl {
|
|
9
|
+
_map: SDKMap;
|
|
10
|
+
_container: HTMLElement;
|
|
11
|
+
_terrainButton: HTMLButtonElement;
|
|
12
|
+
constructor();
|
|
13
|
+
onAdd(map: SDKMap): HTMLElement;
|
|
14
|
+
onRemove(): void;
|
|
15
|
+
_toggleTerrain(): void;
|
|
16
|
+
_updateTerrainIcon(): void;
|
|
17
|
+
}
|