@maptiler/sdk 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +1 -0
- package/dist/maptiler-sdk.css +1 -1
- package/dist/maptiler-sdk.d.ts +190 -241
- package/dist/maptiler-sdk.min.mjs +3 -3
- package/dist/maptiler-sdk.mjs +487 -460
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/package.json +3 -3
- package/readme.md +211 -6
- package/CHANGELOG.md +0 -157
- package/colorramp.md +0 -93
- package/dist/maptiler-sdk.umd.js +0 -6997
- package/dist/maptiler-sdk.umd.js.map +0 -1
- package/dist/maptiler-sdk.umd.min.js +0 -582
- package/src/AttributionControl.ts +0 -13
- package/src/CanvasSource.ts +0 -13
- package/src/FullscreenControl.ts +0 -13
- package/src/GeoJSONSource.ts +0 -13
- package/src/GeolocateControl.ts +0 -13
- package/src/ImageSource.ts +0 -13
- package/src/LogoControl.ts +0 -13
- package/src/Map.ts +0 -1328
- package/src/MaptilerGeolocateControl.ts +0 -207
- package/src/MaptilerLogoControl.ts +0 -58
- package/src/MaptilerNavigationControl.ts +0 -69
- package/src/MaptilerTerrainControl.ts +0 -72
- package/src/Marker.ts +0 -13
- package/src/Minimap.ts +0 -373
- package/src/NavigationControl.ts +0 -13
- package/src/Point.ts +0 -334
- package/src/Popup.ts +0 -13
- package/src/RasterDEMTileSource.ts +0 -13
- package/src/RasterTileSource.ts +0 -13
- package/src/ScaleControl.ts +0 -13
- package/src/Style.ts +0 -13
- package/src/TerrainControl.ts +0 -13
- package/src/VectorTileSource.ts +0 -13
- package/src/VideoSource.ts +0 -13
- package/src/colorramp.ts +0 -1216
- package/src/config.ts +0 -96
- package/src/converters/index.ts +0 -1
- package/src/converters/xml.ts +0 -681
- package/src/defaults.ts +0 -20
- package/src/helpers/index.ts +0 -27
- package/src/helpers/stylehelper.ts +0 -395
- package/src/helpers/vectorlayerhelpers.ts +0 -1511
- package/src/index.ts +0 -242
- package/src/language.ts +0 -183
- package/src/mapstyle.ts +0 -46
- package/src/style/style_template.css +0 -146
- package/src/style/svg/v6-compass.svg +0 -12
- package/src/style/svg/v6-fullscreen-off.svg +0 -7
- package/src/style/svg/v6-fullscreen.svg +0 -7
- package/src/style/svg/v6-geolocate-active-error.svg +0 -10
- package/src/style/svg/v6-geolocate-active.svg +0 -7
- package/src/style/svg/v6-geolocate-background.svg +0 -8
- package/src/style/svg/v6-geolocate-disabled.svg +0 -10
- package/src/style/svg/v6-geolocate.svg +0 -7
- package/src/style/svg/v6-terrain-on.svg +0 -7
- package/src/style/svg/v6-terrain.svg +0 -7
- package/src/style/svg/v6-zoom-minus.svg +0 -7
- package/src/style/svg/v6-zoom-plus.svg +0 -7
- package/src/tools.ts +0 -171
- package/src/unit.ts +0 -1
package/dist/maptiler-sdk.mjs
CHANGED
|
@@ -1,11 +1,110 @@
|
|
|
1
|
-
import
|
|
2
|
-
export * from 'maplibre-gl';
|
|
1
|
+
import maplibregl, { addProtocol as addProtocol$1 } from 'maplibre-gl';
|
|
3
2
|
import { Base64 } from 'js-base64';
|
|
4
3
|
import EventEmitter from 'events';
|
|
5
|
-
import { config as config$
|
|
6
|
-
export { LanguageGeocoding, MapStyle, MapStyleVariant, ReferenceMapStyle, ServiceError, coordinates, data, geocoding, geolocation, staticMaps } from '@maptiler/client';
|
|
4
|
+
import { config as config$2, MapStyle, mapStylePresetList, expandMapStyle, MapStyleVariant, ReferenceMapStyle, geolocation } from '@maptiler/client';
|
|
5
|
+
export { LanguageGeocoding, MapStyle, MapStyleVariant, ReferenceMapStyle, ServiceError, bufferToPixelDataBrowser, circumferenceAtLatitude, coordinates, data, elevation, expandMapStyle, geocoding, geolocation, getAutoLanguageGeocoding, getBufferToPixelDataParser, getTileCache, mapStylePresetList, math, misc, staticMaps, styleToStyle } from '@maptiler/client';
|
|
7
6
|
import { v4 } from 'uuid';
|
|
8
7
|
|
|
8
|
+
var name = "@maptiler/sdk";
|
|
9
|
+
var version = "2.0.0";
|
|
10
|
+
var description = "The Javascript & TypeScript map SDK tailored for MapTiler Cloud";
|
|
11
|
+
var module = "dist/maptiler-sdk.mjs";
|
|
12
|
+
var types = "dist/maptiler-sdk.d.ts";
|
|
13
|
+
var style = "dist/maptiler-sdk.css";
|
|
14
|
+
var type = "module";
|
|
15
|
+
var exports = {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./dist/maptiler-sdk.mjs",
|
|
18
|
+
types: "./dist/maptiler-sdk.d.ts"
|
|
19
|
+
},
|
|
20
|
+
"./dist/maptiler-sdk.css": {
|
|
21
|
+
"import": "./dist/maptiler-sdk.css"
|
|
22
|
+
},
|
|
23
|
+
"./style.css": {
|
|
24
|
+
"import": "./dist/maptiler-sdk.css"
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var keywords = [
|
|
28
|
+
"maptiler",
|
|
29
|
+
"map",
|
|
30
|
+
"sdk",
|
|
31
|
+
"webmap",
|
|
32
|
+
"cloud",
|
|
33
|
+
"webGL",
|
|
34
|
+
"maplibre"
|
|
35
|
+
];
|
|
36
|
+
var homepage = "https://docs.maptiler.com/sdk-js/";
|
|
37
|
+
var license = "BSD-3-Clause";
|
|
38
|
+
var repository = {
|
|
39
|
+
type: "git",
|
|
40
|
+
url: "https://github.com/maptiler/maptiler-sdk-js.git"
|
|
41
|
+
};
|
|
42
|
+
var scripts = {
|
|
43
|
+
build: "rm -rf dist/* && NODE_ENV=production rollup -c",
|
|
44
|
+
dev: "rm -rf dist/* && NODE_ENV=development rollup -c -w",
|
|
45
|
+
"format:fix": "prettier --write \"src/**/*.{js,ts,tsx}\"",
|
|
46
|
+
format: "prettier -c \"src/**/*.{js,ts,tsx}\"",
|
|
47
|
+
"lint:fix": "eslint --fix \"src/**/*.{js,ts}\"",
|
|
48
|
+
lint: "eslint \"src/**/*.{js,ts}\"",
|
|
49
|
+
doc: "rm -rf docs/* && typedoc --out docs && cp -r images docs/",
|
|
50
|
+
prepare: "npm run format:fix && npm run lint:fix && npm run build && npm run test",
|
|
51
|
+
"test:dev": "vitest dev",
|
|
52
|
+
test: "vitest run"
|
|
53
|
+
};
|
|
54
|
+
var author = "MapTiler";
|
|
55
|
+
var devDependencies = {
|
|
56
|
+
"@rollup/plugin-commonjs": "^24.1.0",
|
|
57
|
+
"@rollup/plugin-json": "^6.0.0",
|
|
58
|
+
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
59
|
+
"@types/uuid": "^9.0.2",
|
|
60
|
+
"@types/xmldom": "^0.1.31",
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "^6.9.0",
|
|
62
|
+
"@typescript-eslint/parser": "^6.9.0",
|
|
63
|
+
eslint: "^8.52.0",
|
|
64
|
+
"eslint-config-prettier": "^9.0.0",
|
|
65
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
66
|
+
prettier: "^3.0.3",
|
|
67
|
+
rollup: "^3.20.6",
|
|
68
|
+
"rollup-plugin-copy-merge": "^1.0.0",
|
|
69
|
+
"rollup-plugin-dts": "^5.3.0",
|
|
70
|
+
"rollup-plugin-esbuild": "^5.0.0",
|
|
71
|
+
"rollup-plugin-node-globals": "^1.4.0",
|
|
72
|
+
"rollup-plugin-shell": "^1.0.9",
|
|
73
|
+
"rollup-plugin-string": "^3.0.0",
|
|
74
|
+
"rollup-plugin-swc": "^0.2.1",
|
|
75
|
+
serve: "^14.2.0",
|
|
76
|
+
terser: "^5.17.1",
|
|
77
|
+
typedoc: "^0.24.8",
|
|
78
|
+
typescript: "^5.1.6",
|
|
79
|
+
vitest: "^0.34.2",
|
|
80
|
+
xmldom: "^0.6.0"
|
|
81
|
+
};
|
|
82
|
+
var dependencies = {
|
|
83
|
+
"@maptiler/client": "^1.8.1",
|
|
84
|
+
events: "^3.3.0",
|
|
85
|
+
"js-base64": "^3.7.4",
|
|
86
|
+
"maplibre-gl": "4.1.2",
|
|
87
|
+
uuid: "^9.0.0"
|
|
88
|
+
};
|
|
89
|
+
var packagejson = {
|
|
90
|
+
name: name,
|
|
91
|
+
version: version,
|
|
92
|
+
description: description,
|
|
93
|
+
module: module,
|
|
94
|
+
types: types,
|
|
95
|
+
style: style,
|
|
96
|
+
type: type,
|
|
97
|
+
exports: exports,
|
|
98
|
+
keywords: keywords,
|
|
99
|
+
homepage: homepage,
|
|
100
|
+
license: license,
|
|
101
|
+
repository: repository,
|
|
102
|
+
scripts: scripts,
|
|
103
|
+
author: author,
|
|
104
|
+
devDependencies: devDependencies,
|
|
105
|
+
dependencies: dependencies
|
|
106
|
+
};
|
|
107
|
+
|
|
9
108
|
const Language = {
|
|
10
109
|
/**
|
|
11
110
|
* The visitor language mode concatenates the prefered language from the user settings and the "default name".
|
|
@@ -160,10 +259,10 @@ const defaults = {
|
|
|
160
259
|
};
|
|
161
260
|
Object.freeze(defaults);
|
|
162
261
|
|
|
163
|
-
var __defProp$
|
|
164
|
-
var __defNormalProp$
|
|
165
|
-
var __publicField$
|
|
166
|
-
__defNormalProp$
|
|
262
|
+
var __defProp$a = Object.defineProperty;
|
|
263
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
264
|
+
var __publicField$7 = (obj, key, value) => {
|
|
265
|
+
__defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
167
266
|
return value;
|
|
168
267
|
};
|
|
169
268
|
const MAPTILER_SESSION_ID = v4();
|
|
@@ -173,12 +272,12 @@ class SdkConfig extends EventEmitter {
|
|
|
173
272
|
/**
|
|
174
273
|
* The primary language. By default, the language of the web browser is used.
|
|
175
274
|
*/
|
|
176
|
-
__publicField$
|
|
275
|
+
__publicField$7(this, "primaryLanguage", defaults.primaryLanguage);
|
|
177
276
|
/**
|
|
178
277
|
* The secondary language, to overwrite the default language defined in the map style.
|
|
179
278
|
* This settings is highly dependant on the style compatibility and may not work in most cases.
|
|
180
279
|
*/
|
|
181
|
-
__publicField$
|
|
280
|
+
__publicField$7(this, "secondaryLanguage");
|
|
182
281
|
/**
|
|
183
282
|
* Setting on whether of not the SDK runs with a session logic.
|
|
184
283
|
* A "session" is started at the initialization of the SDK and finished when the browser
|
|
@@ -186,15 +285,21 @@ class SdkConfig extends EventEmitter {
|
|
|
186
285
|
* When `session` is enabled (default: true), the extra URL param `mtsid` is added to queries
|
|
187
286
|
* on the MapTiler Cloud API. This allows MapTiler to enable "session based billing".
|
|
188
287
|
*/
|
|
189
|
-
__publicField$
|
|
288
|
+
__publicField$7(this, "session", true);
|
|
289
|
+
/**
|
|
290
|
+
* Enables client-side caching of requests for tiles and fonts.
|
|
291
|
+
* The cached requests persist multiple browser sessions and will be reused when possible.
|
|
292
|
+
* Works only for requests to the MapTiler Cloud API when sessions are enabled.
|
|
293
|
+
*/
|
|
294
|
+
__publicField$7(this, "caching", true);
|
|
190
295
|
/**
|
|
191
296
|
* Unit to be used
|
|
192
297
|
*/
|
|
193
|
-
__publicField$
|
|
298
|
+
__publicField$7(this, "_unit", "metric");
|
|
194
299
|
/**
|
|
195
300
|
* MapTiler Cloud API key
|
|
196
301
|
*/
|
|
197
|
-
__publicField$
|
|
302
|
+
__publicField$7(this, "_apiKey", "");
|
|
198
303
|
}
|
|
199
304
|
/**
|
|
200
305
|
* Set the unit system
|
|
@@ -214,7 +319,7 @@ class SdkConfig extends EventEmitter {
|
|
|
214
319
|
*/
|
|
215
320
|
set apiKey(k) {
|
|
216
321
|
this._apiKey = k;
|
|
217
|
-
config$
|
|
322
|
+
config$2.apiKey = k;
|
|
218
323
|
this.emit("apiKey", k);
|
|
219
324
|
}
|
|
220
325
|
/**
|
|
@@ -227,35 +332,35 @@ class SdkConfig extends EventEmitter {
|
|
|
227
332
|
* Set a the custom fetch function to replace the default one
|
|
228
333
|
*/
|
|
229
334
|
set fetch(f) {
|
|
230
|
-
config$
|
|
335
|
+
config$2.fetch = f;
|
|
231
336
|
}
|
|
232
337
|
/**
|
|
233
338
|
* Get the fetch fucntion
|
|
234
339
|
*/
|
|
235
340
|
get fetch() {
|
|
236
|
-
return config$
|
|
341
|
+
return config$2.fetch;
|
|
237
342
|
}
|
|
238
343
|
}
|
|
239
|
-
const config = new SdkConfig();
|
|
344
|
+
const config$1 = new SdkConfig();
|
|
240
345
|
|
|
241
|
-
class LogoControl extends
|
|
346
|
+
class LogoControl extends maplibregl.LogoControl {
|
|
242
347
|
onAdd(map) {
|
|
243
348
|
return super.onAdd(map);
|
|
244
349
|
}
|
|
245
350
|
}
|
|
246
351
|
|
|
247
|
-
var __defProp$
|
|
248
|
-
var __defNormalProp$
|
|
249
|
-
var __publicField$
|
|
250
|
-
__defNormalProp$
|
|
352
|
+
var __defProp$9 = Object.defineProperty;
|
|
353
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
354
|
+
var __publicField$6 = (obj, key, value) => {
|
|
355
|
+
__defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
251
356
|
return value;
|
|
252
357
|
};
|
|
253
358
|
class MaptilerLogoControl extends LogoControl {
|
|
254
359
|
constructor(options = {}) {
|
|
255
360
|
var _a, _b;
|
|
256
361
|
super(options);
|
|
257
|
-
__publicField$
|
|
258
|
-
__publicField$
|
|
362
|
+
__publicField$6(this, "logoURL", "");
|
|
363
|
+
__publicField$6(this, "linkURL", "");
|
|
259
364
|
this.logoURL = (_a = options.logoURL) != null ? _a : defaults.maptilerLogoURL;
|
|
260
365
|
this.linkURL = (_b = options.linkURL) != null ? _b : defaults.maptilerURL;
|
|
261
366
|
}
|
|
@@ -290,25 +395,151 @@ class MaptilerLogoControl extends LogoControl {
|
|
|
290
395
|
}
|
|
291
396
|
}
|
|
292
397
|
|
|
293
|
-
var
|
|
398
|
+
var __async$2 = (__this, __arguments, generator) => {
|
|
399
|
+
return new Promise((resolve, reject) => {
|
|
400
|
+
var fulfilled = (value) => {
|
|
401
|
+
try {
|
|
402
|
+
step(generator.next(value));
|
|
403
|
+
} catch (e) {
|
|
404
|
+
reject(e);
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
var rejected = (value) => {
|
|
408
|
+
try {
|
|
409
|
+
step(generator.throw(value));
|
|
410
|
+
} catch (e) {
|
|
411
|
+
reject(e);
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
415
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
416
|
+
});
|
|
417
|
+
};
|
|
418
|
+
const LOCAL_CACHE_PROTOCOL_SOURCE = "localcache_source";
|
|
419
|
+
const LOCAL_CACHE_PROTOCOL_DATA = "localcache";
|
|
420
|
+
const LOCAL_CACHE_NAME = "maptiler_sdk";
|
|
421
|
+
const CACHE_LIMIT_ITEMS = 1e3;
|
|
422
|
+
const CACHE_LIMIT_CHECK_INTERVAL = 100;
|
|
423
|
+
function localCacheTransformRequest(reqUrl, resourceType) {
|
|
424
|
+
if (config$1.caching && config$1.session && reqUrl.host === defaults.maptilerApiHost) {
|
|
425
|
+
if (resourceType == "Source") {
|
|
426
|
+
return reqUrl.href.replace(
|
|
427
|
+
"https://",
|
|
428
|
+
`${LOCAL_CACHE_PROTOCOL_SOURCE}://`
|
|
429
|
+
);
|
|
430
|
+
} else if (resourceType == "Tile" || resourceType == "Glyphs") {
|
|
431
|
+
return reqUrl.href.replace("https://", `${LOCAL_CACHE_PROTOCOL_DATA}://`);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return reqUrl.href;
|
|
435
|
+
}
|
|
436
|
+
let cacheInstance;
|
|
437
|
+
function getCache() {
|
|
438
|
+
return __async$2(this, null, function* () {
|
|
439
|
+
if (!cacheInstance) {
|
|
440
|
+
cacheInstance = yield caches.open(LOCAL_CACHE_NAME);
|
|
441
|
+
}
|
|
442
|
+
return cacheInstance;
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
let cachePutCounter = 0;
|
|
446
|
+
function limitCache() {
|
|
447
|
+
return __async$2(this, null, function* () {
|
|
448
|
+
const cache = yield getCache();
|
|
449
|
+
const keys = yield cache.keys();
|
|
450
|
+
const toPurge = keys.slice(0, Math.max(keys.length - CACHE_LIMIT_ITEMS, 0));
|
|
451
|
+
for (const key of toPurge) {
|
|
452
|
+
cache.delete(key);
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
function registerLocalCacheProtocol() {
|
|
457
|
+
addProtocol$1(
|
|
458
|
+
LOCAL_CACHE_PROTOCOL_SOURCE,
|
|
459
|
+
(params, abortController) => __async$2(this, null, function* () {
|
|
460
|
+
if (!params.url)
|
|
461
|
+
throw new Error("");
|
|
462
|
+
params.url = params.url.replace(
|
|
463
|
+
`${LOCAL_CACHE_PROTOCOL_SOURCE}://`,
|
|
464
|
+
"https://"
|
|
465
|
+
);
|
|
466
|
+
const requestInit = params;
|
|
467
|
+
requestInit.signal = abortController.signal;
|
|
468
|
+
const response = yield fetch(params.url, requestInit);
|
|
469
|
+
const json = yield response.json();
|
|
470
|
+
json.tiles[0] += "&last-modified=" + response.headers.get("Last-Modified");
|
|
471
|
+
return {
|
|
472
|
+
data: json,
|
|
473
|
+
cacheControl: response.headers.get("Cache-Control"),
|
|
474
|
+
expires: response.headers.get("Expires")
|
|
475
|
+
};
|
|
476
|
+
})
|
|
477
|
+
);
|
|
478
|
+
addProtocol$1(
|
|
479
|
+
LOCAL_CACHE_PROTOCOL_DATA,
|
|
480
|
+
(params, abortController) => __async$2(this, null, function* () {
|
|
481
|
+
if (!params.url)
|
|
482
|
+
throw new Error("");
|
|
483
|
+
params.url = params.url.replace(
|
|
484
|
+
`${LOCAL_CACHE_PROTOCOL_DATA}://`,
|
|
485
|
+
"https://"
|
|
486
|
+
);
|
|
487
|
+
const url = new URL(params.url);
|
|
488
|
+
const cacheableUrl = new URL(url);
|
|
489
|
+
cacheableUrl.searchParams.delete("mtsid");
|
|
490
|
+
cacheableUrl.searchParams.delete("key");
|
|
491
|
+
const cacheKey = cacheableUrl.toString();
|
|
492
|
+
const fetchableUrl = new URL(url);
|
|
493
|
+
fetchableUrl.searchParams.delete("last-modified");
|
|
494
|
+
const fetchUrl = fetchableUrl.toString();
|
|
495
|
+
const respond = (response) => __async$2(this, null, function* () {
|
|
496
|
+
return {
|
|
497
|
+
data: yield response.arrayBuffer(),
|
|
498
|
+
cacheControl: response.headers.get("Cache-Control"),
|
|
499
|
+
expires: response.headers.get("Expires")
|
|
500
|
+
};
|
|
501
|
+
});
|
|
502
|
+
const cache = yield getCache();
|
|
503
|
+
const cacheMatch = yield cache.match(cacheKey);
|
|
504
|
+
if (cacheMatch) {
|
|
505
|
+
return respond(cacheMatch);
|
|
506
|
+
} else {
|
|
507
|
+
const requestInit = params;
|
|
508
|
+
requestInit.signal = abortController.signal;
|
|
509
|
+
const response = yield fetch(fetchUrl, requestInit);
|
|
510
|
+
if (response.status >= 200 && response.status < 300) {
|
|
511
|
+
cache.put(cacheKey, response.clone()).catch(() => {
|
|
512
|
+
});
|
|
513
|
+
if (++cachePutCounter > CACHE_LIMIT_CHECK_INTERVAL) {
|
|
514
|
+
limitCache();
|
|
515
|
+
cachePutCounter = 0;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
return respond(response);
|
|
519
|
+
}
|
|
520
|
+
})
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
var __defProp$8 = Object.defineProperty;
|
|
294
525
|
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
295
526
|
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
296
527
|
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
297
|
-
var __defNormalProp$
|
|
528
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
298
529
|
var __spreadValues$5 = (a, b) => {
|
|
299
530
|
for (var prop in b || (b = {}))
|
|
300
531
|
if (__hasOwnProp$5.call(b, prop))
|
|
301
|
-
__defNormalProp$
|
|
532
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
302
533
|
if (__getOwnPropSymbols$5)
|
|
303
534
|
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
304
535
|
if (__propIsEnum$5.call(b, prop))
|
|
305
|
-
__defNormalProp$
|
|
536
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
306
537
|
}
|
|
307
538
|
return a;
|
|
308
539
|
};
|
|
309
540
|
function enableRTL() {
|
|
310
|
-
if (
|
|
311
|
-
|
|
541
|
+
if (maplibregl.getRTLTextPluginStatus() === "unavailable") {
|
|
542
|
+
maplibregl.setRTLTextPlugin(
|
|
312
543
|
defaults.rtlPluginURL,
|
|
313
544
|
(err) => {
|
|
314
545
|
if (err)
|
|
@@ -339,7 +570,7 @@ function DOMremove(node) {
|
|
|
339
570
|
node.parentNode.removeChild(node);
|
|
340
571
|
}
|
|
341
572
|
}
|
|
342
|
-
function maptilerCloudTransformRequest(url,
|
|
573
|
+
function maptilerCloudTransformRequest(url, resourceType) {
|
|
343
574
|
let reqUrl = null;
|
|
344
575
|
try {
|
|
345
576
|
reqUrl = new URL(url);
|
|
@@ -350,14 +581,14 @@ function maptilerCloudTransformRequest(url, _resourceType) {
|
|
|
350
581
|
}
|
|
351
582
|
if (reqUrl.host === defaults.maptilerApiHost) {
|
|
352
583
|
if (!reqUrl.searchParams.has("key")) {
|
|
353
|
-
reqUrl.searchParams.append("key", config.apiKey);
|
|
584
|
+
reqUrl.searchParams.append("key", config$1.apiKey);
|
|
354
585
|
}
|
|
355
|
-
if (config.session) {
|
|
586
|
+
if (config$1.session) {
|
|
356
587
|
reqUrl.searchParams.append("mtsid", MAPTILER_SESSION_ID);
|
|
357
588
|
}
|
|
358
589
|
}
|
|
359
590
|
return {
|
|
360
|
-
url: reqUrl
|
|
591
|
+
url: localCacheTransformRequest(reqUrl, resourceType)
|
|
361
592
|
};
|
|
362
593
|
}
|
|
363
594
|
function combineTransformRequest(userDefinedRTF) {
|
|
@@ -365,10 +596,10 @@ function combineTransformRequest(userDefinedRTF) {
|
|
|
365
596
|
var _a;
|
|
366
597
|
if (userDefinedRTF !== void 0) {
|
|
367
598
|
const rp = userDefinedRTF(url, resourceType);
|
|
368
|
-
const rp2 = maptilerCloudTransformRequest((_a = rp == null ? void 0 : rp.url) != null ? _a : "");
|
|
599
|
+
const rp2 = maptilerCloudTransformRequest((_a = rp == null ? void 0 : rp.url) != null ? _a : "", resourceType);
|
|
369
600
|
return __spreadValues$5(__spreadValues$5({}, rp), rp2);
|
|
370
601
|
} else {
|
|
371
|
-
return maptilerCloudTransformRequest(url);
|
|
602
|
+
return maptilerCloudTransformRequest(url, resourceType);
|
|
372
603
|
}
|
|
373
604
|
};
|
|
374
605
|
}
|
|
@@ -407,17 +638,17 @@ function styleToStyle(style) {
|
|
|
407
638
|
return style;
|
|
408
639
|
}
|
|
409
640
|
|
|
410
|
-
var __defProp$
|
|
411
|
-
var __defNormalProp$
|
|
412
|
-
var __publicField$
|
|
413
|
-
__defNormalProp$
|
|
641
|
+
var __defProp$7 = Object.defineProperty;
|
|
642
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
643
|
+
var __publicField$5 = (obj, key, value) => {
|
|
644
|
+
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
414
645
|
return value;
|
|
415
646
|
};
|
|
416
647
|
class MaptilerTerrainControl {
|
|
417
648
|
constructor() {
|
|
418
|
-
__publicField$
|
|
419
|
-
__publicField$
|
|
420
|
-
__publicField$
|
|
649
|
+
__publicField$5(this, "_map");
|
|
650
|
+
__publicField$5(this, "_container");
|
|
651
|
+
__publicField$5(this, "_terrainButton");
|
|
421
652
|
bindAll(["_toggleTerrain", "_updateTerrainIcon"], this);
|
|
422
653
|
}
|
|
423
654
|
onAdd(map) {
|
|
@@ -457,27 +688,27 @@ class MaptilerTerrainControl {
|
|
|
457
688
|
if (this._map.hasTerrain()) {
|
|
458
689
|
this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled");
|
|
459
690
|
this._terrainButton.title = this._map._getUIString(
|
|
460
|
-
"TerrainControl.
|
|
691
|
+
"TerrainControl.Disable"
|
|
461
692
|
);
|
|
462
693
|
} else {
|
|
463
694
|
this._terrainButton.classList.add("maplibregl-ctrl-terrain");
|
|
464
695
|
this._terrainButton.title = this._map._getUIString(
|
|
465
|
-
"TerrainControl.
|
|
696
|
+
"TerrainControl.Enable"
|
|
466
697
|
);
|
|
467
698
|
}
|
|
468
699
|
}
|
|
469
700
|
}
|
|
470
701
|
|
|
471
|
-
class NavigationControl extends
|
|
702
|
+
class NavigationControl extends maplibregl.NavigationControl {
|
|
472
703
|
onAdd(map) {
|
|
473
704
|
return super.onAdd(map);
|
|
474
705
|
}
|
|
475
706
|
}
|
|
476
707
|
|
|
477
|
-
var __defProp$
|
|
478
|
-
var __defNormalProp$
|
|
479
|
-
var __publicField$
|
|
480
|
-
__defNormalProp$
|
|
708
|
+
var __defProp$6 = Object.defineProperty;
|
|
709
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
710
|
+
var __publicField$4 = (obj, key, value) => {
|
|
711
|
+
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
481
712
|
return value;
|
|
482
713
|
};
|
|
483
714
|
class MaptilerNavigationControl extends NavigationControl {
|
|
@@ -490,7 +721,7 @@ class MaptilerNavigationControl extends NavigationControl {
|
|
|
490
721
|
/**
|
|
491
722
|
* Overloading: Limit how flat the compass icon can get
|
|
492
723
|
*/
|
|
493
|
-
__publicField$
|
|
724
|
+
__publicField$4(this, "_rotateCompassArrow", () => {
|
|
494
725
|
const rotate = this.options.visualizePitch ? `scale(${Math.min(
|
|
495
726
|
1.5,
|
|
496
727
|
1 / Math.pow(
|
|
@@ -529,49 +760,49 @@ class MaptilerNavigationControl extends NavigationControl {
|
|
|
529
760
|
}
|
|
530
761
|
}
|
|
531
762
|
|
|
532
|
-
class GeolocateControl extends
|
|
763
|
+
class GeolocateControl extends maplibregl.GeolocateControl {
|
|
533
764
|
onAdd(map) {
|
|
534
765
|
return super.onAdd(map);
|
|
535
766
|
}
|
|
536
767
|
}
|
|
537
768
|
|
|
538
|
-
var __defProp$
|
|
769
|
+
var __defProp$5 = Object.defineProperty;
|
|
539
770
|
var __defProps$3 = Object.defineProperties;
|
|
540
771
|
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
541
772
|
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
542
773
|
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
543
774
|
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
544
|
-
var __defNormalProp$
|
|
775
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
545
776
|
var __spreadValues$4 = (a, b) => {
|
|
546
777
|
for (var prop in b || (b = {}))
|
|
547
778
|
if (__hasOwnProp$4.call(b, prop))
|
|
548
|
-
__defNormalProp$
|
|
779
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
549
780
|
if (__getOwnPropSymbols$4)
|
|
550
781
|
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
551
782
|
if (__propIsEnum$4.call(b, prop))
|
|
552
|
-
__defNormalProp$
|
|
783
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
553
784
|
}
|
|
554
785
|
return a;
|
|
555
786
|
};
|
|
556
787
|
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
557
|
-
var __publicField$
|
|
558
|
-
__defNormalProp$
|
|
788
|
+
var __publicField$3 = (obj, key, value) => {
|
|
789
|
+
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
559
790
|
return value;
|
|
560
791
|
};
|
|
561
|
-
const Marker$1 =
|
|
562
|
-
const LngLat$1 =
|
|
563
|
-
const LngLatBounds$1 =
|
|
792
|
+
const Marker$1 = maplibregl.Marker;
|
|
793
|
+
const LngLat$1 = maplibregl.LngLat;
|
|
794
|
+
const LngLatBounds$1 = maplibregl.LngLatBounds;
|
|
564
795
|
class MaptilerGeolocateControl extends GeolocateControl {
|
|
565
796
|
constructor() {
|
|
566
797
|
super(...arguments);
|
|
567
|
-
__publicField$
|
|
798
|
+
__publicField$3(this, "lastUpdatedCenter", new LngLat$1(0, 0));
|
|
568
799
|
/**
|
|
569
800
|
* Update the camera location to center on the current position
|
|
570
801
|
*
|
|
571
802
|
* @param {Position} position the Geolocation API Position
|
|
572
803
|
* @private
|
|
573
804
|
*/
|
|
574
|
-
__publicField$
|
|
805
|
+
__publicField$3(this, "_updateCamera", (position) => {
|
|
575
806
|
var _a, _b, _c;
|
|
576
807
|
const center = new LngLat$1(
|
|
577
808
|
position.coords.longitude,
|
|
@@ -615,7 +846,7 @@ class MaptilerGeolocateControl extends GeolocateControl {
|
|
|
615
846
|
this.lastUpdatedCenter = this._map.getCenter();
|
|
616
847
|
});
|
|
617
848
|
});
|
|
618
|
-
__publicField$
|
|
849
|
+
__publicField$3(this, "_setupUI", (supported) => {
|
|
619
850
|
this.lastUpdatedCenter = this._map.getCenter();
|
|
620
851
|
this._container.addEventListener(
|
|
621
852
|
"contextmenu",
|
|
@@ -684,7 +915,7 @@ class MaptilerGeolocateControl extends GeolocateControl {
|
|
|
684
915
|
});
|
|
685
916
|
}
|
|
686
917
|
});
|
|
687
|
-
__publicField$
|
|
918
|
+
__publicField$3(this, "_onZoom", () => {
|
|
688
919
|
if (this.options.showUserLocation && this.options.showAccuracyCircle) {
|
|
689
920
|
this._updateCircleRadius();
|
|
690
921
|
}
|
|
@@ -711,45 +942,45 @@ class MaptilerGeolocateControl extends GeolocateControl {
|
|
|
711
942
|
}
|
|
712
943
|
}
|
|
713
944
|
|
|
714
|
-
class AttributionControl extends
|
|
945
|
+
class AttributionControl extends maplibregl.AttributionControl {
|
|
715
946
|
onAdd(map) {
|
|
716
947
|
return super.onAdd(map);
|
|
717
948
|
}
|
|
718
949
|
}
|
|
719
950
|
|
|
720
|
-
class ScaleControl extends
|
|
951
|
+
class ScaleControl extends maplibregl.ScaleControl {
|
|
721
952
|
onAdd(map) {
|
|
722
953
|
return super.onAdd(map);
|
|
723
954
|
}
|
|
724
955
|
}
|
|
725
956
|
|
|
726
|
-
class FullscreenControl extends
|
|
957
|
+
class FullscreenControl extends maplibregl.FullscreenControl {
|
|
727
958
|
onAdd(map) {
|
|
728
959
|
return super.onAdd(map);
|
|
729
960
|
}
|
|
730
961
|
}
|
|
731
962
|
|
|
732
|
-
var __defProp$
|
|
963
|
+
var __defProp$4 = Object.defineProperty;
|
|
733
964
|
var __defProps$2 = Object.defineProperties;
|
|
734
965
|
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
735
966
|
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
736
967
|
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
737
968
|
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
738
|
-
var __defNormalProp$
|
|
969
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
739
970
|
var __spreadValues$3 = (a, b) => {
|
|
740
971
|
for (var prop in b || (b = {}))
|
|
741
972
|
if (__hasOwnProp$3.call(b, prop))
|
|
742
|
-
__defNormalProp$
|
|
973
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
743
974
|
if (__getOwnPropSymbols$3)
|
|
744
975
|
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
745
976
|
if (__propIsEnum$3.call(b, prop))
|
|
746
|
-
__defNormalProp$
|
|
977
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
747
978
|
}
|
|
748
979
|
return a;
|
|
749
980
|
};
|
|
750
981
|
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
751
|
-
var __publicField$
|
|
752
|
-
__defNormalProp$
|
|
982
|
+
var __publicField$2 = (obj, key, value) => {
|
|
983
|
+
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
753
984
|
return value;
|
|
754
985
|
};
|
|
755
986
|
var __accessCheck = (obj, member, msg) => {
|
|
@@ -781,7 +1012,7 @@ class Minimap {
|
|
|
781
1012
|
__privateAdd(this, _setParentBounds);
|
|
782
1013
|
__privateAdd(this, _syncMaps);
|
|
783
1014
|
__privateAdd(this, _options, void 0);
|
|
784
|
-
__publicField$
|
|
1015
|
+
__publicField$2(this, "map");
|
|
785
1016
|
__privateAdd(this, _parentMap, void 0);
|
|
786
1017
|
__privateAdd(this, _container, void 0);
|
|
787
1018
|
__privateAdd(this, _canvasContainer, void 0);
|
|
@@ -1013,27 +1244,27 @@ syncMaps_fn = function() {
|
|
|
1013
1244
|
};
|
|
1014
1245
|
};
|
|
1015
1246
|
|
|
1016
|
-
var __defProp$
|
|
1247
|
+
var __defProp$3 = Object.defineProperty;
|
|
1017
1248
|
var __defProps$1 = Object.defineProperties;
|
|
1018
1249
|
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
1019
1250
|
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
1020
1251
|
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
1021
1252
|
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
1022
|
-
var __defNormalProp$
|
|
1253
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1023
1254
|
var __spreadValues$2 = (a, b) => {
|
|
1024
1255
|
for (var prop in b || (b = {}))
|
|
1025
1256
|
if (__hasOwnProp$2.call(b, prop))
|
|
1026
|
-
__defNormalProp$
|
|
1257
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
1027
1258
|
if (__getOwnPropSymbols$2)
|
|
1028
1259
|
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
1029
1260
|
if (__propIsEnum$2.call(b, prop))
|
|
1030
|
-
__defNormalProp$
|
|
1261
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
1031
1262
|
}
|
|
1032
1263
|
return a;
|
|
1033
1264
|
};
|
|
1034
1265
|
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
1035
|
-
var __publicField$
|
|
1036
|
-
__defNormalProp$
|
|
1266
|
+
var __publicField$1 = (obj, key, value) => {
|
|
1267
|
+
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1037
1268
|
return value;
|
|
1038
1269
|
};
|
|
1039
1270
|
var __async$1 = (__this, __arguments, generator) => {
|
|
@@ -1060,15 +1291,15 @@ const GeolocationType = {
|
|
|
1060
1291
|
POINT: "POINT",
|
|
1061
1292
|
COUNTRY: "COUNTRY"
|
|
1062
1293
|
};
|
|
1063
|
-
class Map extends
|
|
1294
|
+
class Map extends maplibregl.Map {
|
|
1064
1295
|
constructor(options) {
|
|
1065
1296
|
var _a, _b, _c;
|
|
1066
1297
|
if (options.apiKey) {
|
|
1067
|
-
config.apiKey = options.apiKey;
|
|
1298
|
+
config$1.apiKey = options.apiKey;
|
|
1068
1299
|
}
|
|
1069
1300
|
const style = styleToStyle(options.style);
|
|
1070
1301
|
const hashPreConstructor = location.hash;
|
|
1071
|
-
if (!config.apiKey) {
|
|
1302
|
+
if (!config$1.apiKey) {
|
|
1072
1303
|
console.warn(
|
|
1073
1304
|
"MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"
|
|
1074
1305
|
);
|
|
@@ -1078,15 +1309,19 @@ class Map extends maplibregl__default.Map {
|
|
|
1078
1309
|
maplibreLogo: false,
|
|
1079
1310
|
transformRequest: combineTransformRequest(options.transformRequest)
|
|
1080
1311
|
}));
|
|
1081
|
-
__publicField$
|
|
1082
|
-
__publicField$
|
|
1083
|
-
__publicField$
|
|
1084
|
-
__publicField$
|
|
1085
|
-
__publicField$
|
|
1086
|
-
__publicField$
|
|
1087
|
-
__publicField$
|
|
1088
|
-
__publicField$
|
|
1089
|
-
this
|
|
1312
|
+
__publicField$1(this, "isTerrainEnabled", false);
|
|
1313
|
+
__publicField$1(this, "terrainExaggeration", 1);
|
|
1314
|
+
__publicField$1(this, "primaryLanguage");
|
|
1315
|
+
__publicField$1(this, "terrainGrowing", false);
|
|
1316
|
+
__publicField$1(this, "terrainFlattening", false);
|
|
1317
|
+
__publicField$1(this, "minimap");
|
|
1318
|
+
__publicField$1(this, "forceLanguageUpdate");
|
|
1319
|
+
__publicField$1(this, "languageAlwaysBeenStyle");
|
|
1320
|
+
__publicField$1(this, "isReady", false);
|
|
1321
|
+
if (config$1.caching) {
|
|
1322
|
+
registerLocalCacheProtocol();
|
|
1323
|
+
}
|
|
1324
|
+
this.primaryLanguage = (_a = options.language) != null ? _a : config$1.primaryLanguage;
|
|
1090
1325
|
this.forceLanguageUpdate = this.primaryLanguage === Language.STYLE || this.primaryLanguage === Language.STYLE_LOCK ? false : true;
|
|
1091
1326
|
this.languageAlwaysBeenStyle = this.primaryLanguage === Language.STYLE;
|
|
1092
1327
|
this.terrainExaggeration = (_b = options.terrainExaggeration) != null ? _b : this.terrainExaggeration;
|
|
@@ -1175,7 +1410,7 @@ class Map extends maplibregl__default.Map {
|
|
|
1175
1410
|
possibleSources[0].url
|
|
1176
1411
|
);
|
|
1177
1412
|
if (!styleUrl.searchParams.has("key")) {
|
|
1178
|
-
styleUrl.searchParams.append("key", config.apiKey);
|
|
1413
|
+
styleUrl.searchParams.append("key", config$1.apiKey);
|
|
1179
1414
|
}
|
|
1180
1415
|
const tileJsonRes = yield fetch(styleUrl.href);
|
|
1181
1416
|
tileJsonContent = yield tileJsonRes.json();
|
|
@@ -1201,9 +1436,9 @@ class Map extends maplibregl__default.Map {
|
|
|
1201
1436
|
}
|
|
1202
1437
|
if (options.scaleControl) {
|
|
1203
1438
|
const position = options.scaleControl === true || options.scaleControl === void 0 ? "bottom-right" : options.scaleControl;
|
|
1204
|
-
const scaleControl = new ScaleControl({ unit: config.unit });
|
|
1439
|
+
const scaleControl = new ScaleControl({ unit: config$1.unit });
|
|
1205
1440
|
this.addControl(scaleControl, position);
|
|
1206
|
-
config.on("unit", (unit) => {
|
|
1441
|
+
config$1.on("unit", (unit) => {
|
|
1207
1442
|
scaleControl.setUnit(unit);
|
|
1208
1443
|
});
|
|
1209
1444
|
}
|
|
@@ -1239,11 +1474,13 @@ class Map extends maplibregl__default.Map {
|
|
|
1239
1474
|
const position = options.fullscreenControl === true || options.fullscreenControl === void 0 ? "top-right" : options.fullscreenControl;
|
|
1240
1475
|
this.addControl(new FullscreenControl({}), position);
|
|
1241
1476
|
}
|
|
1477
|
+
this.isReady = true;
|
|
1478
|
+
this.fire("ready", { target: this });
|
|
1242
1479
|
}));
|
|
1243
1480
|
let loadEventTriggered = false;
|
|
1244
1481
|
let terrainEventTriggered = false;
|
|
1245
1482
|
let terrainEventData;
|
|
1246
|
-
this.once("
|
|
1483
|
+
this.once("ready", () => {
|
|
1247
1484
|
loadEventTriggered = true;
|
|
1248
1485
|
if (terrainEventTriggered) {
|
|
1249
1486
|
this.fire("loadWithTerrain", terrainEventData);
|
|
@@ -1348,6 +1585,26 @@ class Map extends maplibregl__default.Map {
|
|
|
1348
1585
|
});
|
|
1349
1586
|
});
|
|
1350
1587
|
}
|
|
1588
|
+
/**
|
|
1589
|
+
* Awaits for _this_ Map instance to be "ready" and returns a Promise to the Map.
|
|
1590
|
+
* If _this_ Map instance is already ready, the Promise is resolved directly,
|
|
1591
|
+
* otherwise, it is resolved as a result of the "ready" event.
|
|
1592
|
+
* A map instance is "ready" when all the controls that can be managed by the contructor are
|
|
1593
|
+
* dealt with. This happens after the "load" event, due to the asynchronous nature
|
|
1594
|
+
* of some built-in controls.
|
|
1595
|
+
*/
|
|
1596
|
+
onReadyAsync() {
|
|
1597
|
+
return __async$1(this, null, function* () {
|
|
1598
|
+
return new Promise((resolve) => {
|
|
1599
|
+
if (this.isReady) {
|
|
1600
|
+
return resolve(this);
|
|
1601
|
+
}
|
|
1602
|
+
this.once("ready", () => {
|
|
1603
|
+
resolve(this);
|
|
1604
|
+
});
|
|
1605
|
+
});
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1351
1608
|
/**
|
|
1352
1609
|
* Awaits for _this_ Map instance to be "loaded" as well as with terrain being non-null for the first time
|
|
1353
1610
|
* and returns a Promise to the Map.
|
|
@@ -1358,7 +1615,7 @@ class Map extends maplibregl__default.Map {
|
|
|
1358
1615
|
onLoadWithTerrainAsync() {
|
|
1359
1616
|
return __async$1(this, null, function* () {
|
|
1360
1617
|
return new Promise((resolve) => {
|
|
1361
|
-
if (this.
|
|
1618
|
+
if (this.isReady && this.terrain) {
|
|
1362
1619
|
return resolve(this);
|
|
1363
1620
|
}
|
|
1364
1621
|
this.once("loadWithTerrain", () => {
|
|
@@ -1652,7 +1909,23 @@ class Map extends maplibregl__default.Map {
|
|
|
1652
1909
|
];
|
|
1653
1910
|
}
|
|
1654
1911
|
const { layers } = this.getStyle();
|
|
1655
|
-
for (const
|
|
1912
|
+
for (const genericLayer of layers) {
|
|
1913
|
+
if (genericLayer.type !== "symbol") {
|
|
1914
|
+
continue;
|
|
1915
|
+
}
|
|
1916
|
+
const layer = genericLayer;
|
|
1917
|
+
const source = this.getSource(layer.source);
|
|
1918
|
+
if (!source) {
|
|
1919
|
+
continue;
|
|
1920
|
+
}
|
|
1921
|
+
if (!("url" in source && typeof source.url === "string")) {
|
|
1922
|
+
continue;
|
|
1923
|
+
}
|
|
1924
|
+
const sourceURL = new URL(source.url);
|
|
1925
|
+
if (sourceURL.host !== defaults.maptilerApiHost) {
|
|
1926
|
+
continue;
|
|
1927
|
+
}
|
|
1928
|
+
const { id, layout } = layer;
|
|
1656
1929
|
if (!layout) {
|
|
1657
1930
|
continue;
|
|
1658
1931
|
}
|
|
@@ -1884,7 +2157,7 @@ class Map extends maplibregl__default.Map {
|
|
|
1884
2157
|
* that do not directly have access to the SDK configuration but do have access to a Map instance.
|
|
1885
2158
|
*/
|
|
1886
2159
|
getSdkConfig() {
|
|
1887
|
-
return config;
|
|
2160
|
+
return config$1;
|
|
1888
2161
|
}
|
|
1889
2162
|
/**
|
|
1890
2163
|
* Get the MapTiler session ID. Convenient to dispatch to externaly built component
|
|
@@ -1909,383 +2182,119 @@ class Map extends maplibregl__default.Map {
|
|
|
1909
2182
|
super.setTransformRequest(combineTransformRequest(transformRequest));
|
|
1910
2183
|
return this;
|
|
1911
2184
|
}
|
|
1912
|
-
/**
|
|
1913
|
-
* Loads an image. This is an async equivalent of `Map.loadImage`
|
|
1914
|
-
*/
|
|
1915
|
-
loadImageAsync(url) {
|
|
1916
|
-
return __async$1(this, null, function* () {
|
|
1917
|
-
return new Promise((resolve, reject) => {
|
|
1918
|
-
this.loadImage(
|
|
1919
|
-
url,
|
|
1920
|
-
(error, image) => {
|
|
1921
|
-
if (error) {
|
|
1922
|
-
reject(error);
|
|
1923
|
-
return;
|
|
1924
|
-
}
|
|
1925
|
-
resolve(image);
|
|
1926
|
-
}
|
|
1927
|
-
);
|
|
1928
|
-
});
|
|
1929
|
-
});
|
|
1930
|
-
}
|
|
1931
2185
|
}
|
|
1932
2186
|
|
|
1933
|
-
class Marker extends
|
|
2187
|
+
class Marker extends maplibregl.Marker {
|
|
1934
2188
|
addTo(map) {
|
|
1935
2189
|
return super.addTo(map);
|
|
1936
2190
|
}
|
|
1937
2191
|
}
|
|
1938
2192
|
|
|
1939
|
-
class Popup extends
|
|
2193
|
+
class Popup extends maplibregl.Popup {
|
|
1940
2194
|
addTo(map) {
|
|
1941
2195
|
return super.addTo(map);
|
|
1942
2196
|
}
|
|
1943
2197
|
}
|
|
1944
2198
|
|
|
1945
|
-
class Style extends
|
|
2199
|
+
class Style extends maplibregl.Style {
|
|
1946
2200
|
constructor(map, options = {}) {
|
|
1947
2201
|
super(map, options);
|
|
1948
2202
|
}
|
|
1949
2203
|
}
|
|
1950
2204
|
|
|
1951
|
-
class CanvasSource extends
|
|
2205
|
+
class CanvasSource extends maplibregl.CanvasSource {
|
|
1952
2206
|
onAdd(map) {
|
|
1953
2207
|
super.onAdd(map);
|
|
1954
2208
|
}
|
|
1955
2209
|
}
|
|
1956
2210
|
|
|
1957
|
-
class GeoJSONSource extends
|
|
2211
|
+
class GeoJSONSource extends maplibregl.GeoJSONSource {
|
|
1958
2212
|
onAdd(map) {
|
|
1959
2213
|
super.onAdd(map);
|
|
1960
2214
|
}
|
|
1961
2215
|
}
|
|
1962
2216
|
|
|
1963
|
-
class ImageSource extends
|
|
2217
|
+
class ImageSource extends maplibregl.ImageSource {
|
|
1964
2218
|
onAdd(map) {
|
|
1965
2219
|
super.onAdd(map);
|
|
1966
2220
|
}
|
|
1967
2221
|
}
|
|
1968
2222
|
|
|
1969
|
-
class RasterTileSource extends
|
|
2223
|
+
class RasterTileSource extends maplibregl.RasterTileSource {
|
|
1970
2224
|
onAdd(map) {
|
|
1971
2225
|
super.onAdd(map);
|
|
1972
2226
|
}
|
|
1973
2227
|
}
|
|
1974
2228
|
|
|
1975
|
-
class RasterDEMTileSource extends
|
|
2229
|
+
class RasterDEMTileSource extends maplibregl.RasterDEMTileSource {
|
|
1976
2230
|
onAdd(map) {
|
|
1977
2231
|
super.onAdd(map);
|
|
1978
2232
|
}
|
|
1979
2233
|
}
|
|
1980
2234
|
|
|
1981
|
-
class VectorTileSource extends
|
|
2235
|
+
class VectorTileSource extends maplibregl.VectorTileSource {
|
|
1982
2236
|
onAdd(map) {
|
|
1983
2237
|
super.onAdd(map);
|
|
1984
2238
|
}
|
|
1985
2239
|
}
|
|
1986
2240
|
|
|
1987
|
-
class VideoSource extends
|
|
2241
|
+
class VideoSource extends maplibregl.VideoSource {
|
|
1988
2242
|
onAdd(map) {
|
|
1989
2243
|
super.onAdd(map);
|
|
1990
2244
|
}
|
|
1991
2245
|
}
|
|
1992
2246
|
|
|
1993
|
-
class TerrainControl extends
|
|
2247
|
+
class TerrainControl extends maplibregl.TerrainControl {
|
|
1994
2248
|
onAdd(map) {
|
|
1995
2249
|
return super.onAdd(map);
|
|
1996
2250
|
}
|
|
1997
2251
|
}
|
|
1998
2252
|
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2003
|
-
return value;
|
|
2004
|
-
};
|
|
2005
|
-
class Point {
|
|
2006
|
-
constructor(x, y) {
|
|
2007
|
-
__publicField$1(this, "x");
|
|
2008
|
-
__publicField$1(this, "y");
|
|
2009
|
-
this.x = x;
|
|
2010
|
-
this.y = y;
|
|
2011
|
-
}
|
|
2012
|
-
_matMult(m) {
|
|
2013
|
-
const x = m[0] * this.x + m[1] * this.y;
|
|
2014
|
-
const y = m[2] * this.x + m[3] * this.y;
|
|
2015
|
-
this.x = x;
|
|
2016
|
-
this.y = y;
|
|
2017
|
-
return this;
|
|
2018
|
-
}
|
|
2019
|
-
_add(p) {
|
|
2020
|
-
this.x += p.x;
|
|
2021
|
-
this.y += p.y;
|
|
2022
|
-
return this;
|
|
2023
|
-
}
|
|
2024
|
-
_sub(p) {
|
|
2025
|
-
this.x -= p.x;
|
|
2026
|
-
this.y -= p.y;
|
|
2027
|
-
return this;
|
|
2028
|
-
}
|
|
2029
|
-
_mult(k) {
|
|
2030
|
-
this.x *= k;
|
|
2031
|
-
this.y *= k;
|
|
2032
|
-
return this;
|
|
2033
|
-
}
|
|
2034
|
-
_div(k) {
|
|
2035
|
-
this.x /= k;
|
|
2036
|
-
this.y /= k;
|
|
2037
|
-
return this;
|
|
2038
|
-
}
|
|
2039
|
-
_multByPoint(p) {
|
|
2040
|
-
this.x *= p.x;
|
|
2041
|
-
this.y *= p.y;
|
|
2042
|
-
return this;
|
|
2043
|
-
}
|
|
2044
|
-
_divByPoint(p) {
|
|
2045
|
-
this.x /= p.x;
|
|
2046
|
-
this.y /= p.y;
|
|
2047
|
-
return this;
|
|
2048
|
-
}
|
|
2049
|
-
_unit() {
|
|
2050
|
-
this._div(this.mag());
|
|
2051
|
-
return this;
|
|
2052
|
-
}
|
|
2053
|
-
_perp() {
|
|
2054
|
-
const y = this.y;
|
|
2055
|
-
this.y = this.x;
|
|
2056
|
-
this.x = -y;
|
|
2057
|
-
return this;
|
|
2058
|
-
}
|
|
2059
|
-
_rotate(angle) {
|
|
2060
|
-
const cos = Math.cos(angle);
|
|
2061
|
-
const sin = Math.sin(angle);
|
|
2062
|
-
const x = cos * this.x - sin * this.y;
|
|
2063
|
-
const y = sin * this.x + cos * this.y;
|
|
2064
|
-
this.x = x;
|
|
2065
|
-
this.y = y;
|
|
2066
|
-
return this;
|
|
2067
|
-
}
|
|
2068
|
-
_rotateAround(angle, p) {
|
|
2069
|
-
const cos = Math.cos(angle);
|
|
2070
|
-
const sin = Math.sin(angle);
|
|
2071
|
-
const x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y);
|
|
2072
|
-
const y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);
|
|
2073
|
-
this.x = x;
|
|
2074
|
-
this.y = y;
|
|
2075
|
-
return this;
|
|
2076
|
-
}
|
|
2077
|
-
_round() {
|
|
2078
|
-
this.x = Math.round(this.x);
|
|
2079
|
-
this.y = Math.round(this.y);
|
|
2080
|
-
return this;
|
|
2081
|
-
}
|
|
2082
|
-
/**
|
|
2083
|
-
* Clone this point, returning a new point that can be modified
|
|
2084
|
-
* without affecting the old one.
|
|
2085
|
-
* @return {Point} the clone
|
|
2086
|
-
*/
|
|
2087
|
-
clone() {
|
|
2088
|
-
return new Point(this.x, this.y);
|
|
2089
|
-
}
|
|
2090
|
-
/**
|
|
2091
|
-
* Add this point's x & y coordinates to another point,
|
|
2092
|
-
* yielding a new point.
|
|
2093
|
-
* @param {Point} p the other point
|
|
2094
|
-
* @return {Point} output point
|
|
2095
|
-
*/
|
|
2096
|
-
add(p) {
|
|
2097
|
-
return this.clone()._add(p);
|
|
2098
|
-
}
|
|
2099
|
-
/**
|
|
2100
|
-
* Subtract this point's x & y coordinates to from point,
|
|
2101
|
-
* yielding a new point.
|
|
2102
|
-
* @param {Point} p the other point
|
|
2103
|
-
* @return {Point} output point
|
|
2104
|
-
*/
|
|
2105
|
-
sub(p) {
|
|
2106
|
-
return this.clone()._sub(p);
|
|
2107
|
-
}
|
|
2108
|
-
/**
|
|
2109
|
-
* Multiply this point's x & y coordinates by point,
|
|
2110
|
-
* yielding a new point.
|
|
2111
|
-
* @param {Point} p the other point
|
|
2112
|
-
* @return {Point} output point
|
|
2113
|
-
*/
|
|
2114
|
-
multByPoint(p) {
|
|
2115
|
-
return this.clone()._multByPoint(p);
|
|
2116
|
-
}
|
|
2117
|
-
/**
|
|
2118
|
-
* Divide this point's x & y coordinates by point,
|
|
2119
|
-
* yielding a new point.
|
|
2120
|
-
* @param {Point} p the other point
|
|
2121
|
-
* @return {Point} output point
|
|
2122
|
-
*/
|
|
2123
|
-
divByPoint(p) {
|
|
2124
|
-
return this.clone()._divByPoint(p);
|
|
2125
|
-
}
|
|
2126
|
-
/**
|
|
2127
|
-
* Multiply this point's x & y coordinates by a factor,
|
|
2128
|
-
* yielding a new point.
|
|
2129
|
-
* @param {Number} k factor
|
|
2130
|
-
* @return {Point} output point
|
|
2131
|
-
*/
|
|
2132
|
-
mult(k) {
|
|
2133
|
-
return this.clone()._mult(k);
|
|
2134
|
-
}
|
|
2135
|
-
/**
|
|
2136
|
-
* Divide this point's x & y coordinates by a factor,
|
|
2137
|
-
* yielding a new point.
|
|
2138
|
-
* @param {Point} k factor
|
|
2139
|
-
* @return {Point} output point
|
|
2140
|
-
*/
|
|
2141
|
-
div(k) {
|
|
2142
|
-
return this.clone()._div(k);
|
|
2143
|
-
}
|
|
2144
|
-
/**
|
|
2145
|
-
* Rotate this point around the 0, 0 origin by an angle a,
|
|
2146
|
-
* given in radians
|
|
2147
|
-
* @param {Number} a angle to rotate around, in radians
|
|
2148
|
-
* @return {Point} output point
|
|
2149
|
-
*/
|
|
2150
|
-
rotate(a) {
|
|
2151
|
-
return this.clone()._rotate(a);
|
|
2152
|
-
}
|
|
2153
|
-
/**
|
|
2154
|
-
* Rotate this point around p point by an angle a,
|
|
2155
|
-
* given in radians
|
|
2156
|
-
* @param {Number} a angle to rotate around, in radians
|
|
2157
|
-
* @param {Point} p Point to rotate around
|
|
2158
|
-
* @return {Point} output point
|
|
2159
|
-
*/
|
|
2160
|
-
rotateAround(a, p) {
|
|
2161
|
-
return this.clone()._rotateAround(a, p);
|
|
2162
|
-
}
|
|
2163
|
-
/**
|
|
2164
|
-
* Multiply this point by a 4x1 transformation matrix
|
|
2165
|
-
* @param {Array<Number>} m transformation matrix
|
|
2166
|
-
* @return {Point} output point
|
|
2167
|
-
*/
|
|
2168
|
-
matMult(m) {
|
|
2169
|
-
return this.clone()._matMult(m);
|
|
2170
|
-
}
|
|
2171
|
-
/**
|
|
2172
|
-
* Calculate this point but as a unit vector from 0, 0, meaning
|
|
2173
|
-
* that the distance from the resulting point to the 0, 0
|
|
2174
|
-
* coordinate will be equal to 1 and the angle from the resulting
|
|
2175
|
-
* point to the 0, 0 coordinate will be the same as before.
|
|
2176
|
-
* @return {Point} unit vector point
|
|
2177
|
-
*/
|
|
2178
|
-
unit() {
|
|
2179
|
-
return this.clone()._unit();
|
|
2180
|
-
}
|
|
2181
|
-
/**
|
|
2182
|
-
* Compute a perpendicular point, where the new y coordinate
|
|
2183
|
-
* is the old x coordinate and the new x coordinate is the old y
|
|
2184
|
-
* coordinate multiplied by -1
|
|
2185
|
-
* @return {Point} perpendicular point
|
|
2186
|
-
*/
|
|
2187
|
-
perp() {
|
|
2188
|
-
return this.clone()._perp();
|
|
2189
|
-
}
|
|
2190
|
-
/**
|
|
2191
|
-
* Return a version of this point with the x & y coordinates
|
|
2192
|
-
* rounded to integers.
|
|
2193
|
-
* @return {Point} rounded point
|
|
2194
|
-
*/
|
|
2195
|
-
round() {
|
|
2196
|
-
return this.clone()._round();
|
|
2197
|
-
}
|
|
2198
|
-
/**
|
|
2199
|
-
* Return the magnitude of this point: this is the Euclidean
|
|
2200
|
-
* distance from the 0, 0 coordinate to this point's x and y
|
|
2201
|
-
* coordinates.
|
|
2202
|
-
* @return {Number} magnitude
|
|
2203
|
-
*/
|
|
2204
|
-
mag() {
|
|
2205
|
-
return Math.sqrt(this.x * this.x + this.y * this.y);
|
|
2253
|
+
class BoxZoomHandler extends maplibregl.BoxZoomHandler {
|
|
2254
|
+
constructor(map, options) {
|
|
2255
|
+
super(map, options);
|
|
2206
2256
|
}
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
*/
|
|
2213
|
-
equals(other) {
|
|
2214
|
-
return this.x === other.x && this.y === other.y;
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
class ScrollZoomHandler extends maplibregl.ScrollZoomHandler {
|
|
2260
|
+
constructor(map, triggerRenderFrame) {
|
|
2261
|
+
super(map, triggerRenderFrame);
|
|
2215
2262
|
}
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
dist(p) {
|
|
2222
|
-
return Math.sqrt(this.distSqr(p));
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
class CooperativeGesturesHandler extends maplibregl.CooperativeGesturesHandler {
|
|
2266
|
+
constructor(map, options) {
|
|
2267
|
+
super(map, options);
|
|
2223
2268
|
}
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
* @return {Number} distance
|
|
2230
|
-
*/
|
|
2231
|
-
distSqr(p) {
|
|
2232
|
-
const dx = p.x - this.x;
|
|
2233
|
-
const dy = p.y - this.y;
|
|
2234
|
-
return dx * dx + dy * dy;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
class KeyboardHandler extends maplibregl.KeyboardHandler {
|
|
2272
|
+
constructor(map) {
|
|
2273
|
+
super(map);
|
|
2235
2274
|
}
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
angle() {
|
|
2242
|
-
return Math.atan2(this.y, this.x);
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
class TwoFingersTouchPitchHandler extends maplibregl.TwoFingersTouchPitchHandler {
|
|
2278
|
+
constructor(map) {
|
|
2279
|
+
super(map);
|
|
2243
2280
|
}
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
angleTo(b) {
|
|
2250
|
-
return Math.atan2(this.y - b.y, this.x - b.x);
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
class MapWheelEvent extends maplibregl.MapWheelEvent {
|
|
2284
|
+
constructor(type, map, originalEvent) {
|
|
2285
|
+
super(type, map, originalEvent);
|
|
2251
2286
|
}
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
angleWith(b) {
|
|
2258
|
-
return this.angleWithSep(b.x, b.y);
|
|
2259
|
-
}
|
|
2260
|
-
/*
|
|
2261
|
-
* Find the angle of the two vectors, solving the formula for
|
|
2262
|
-
* the cross product a x b = |a||b|sin(θ) for θ.
|
|
2263
|
-
* @param {Number} x the x-coordinate
|
|
2264
|
-
* @param {Number} y the y-coordinate
|
|
2265
|
-
* @return {Number} the angle in radians
|
|
2266
|
-
*/
|
|
2267
|
-
angleWithSep(x, y) {
|
|
2268
|
-
return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
class MapTouchEvent extends maplibregl.MapTouchEvent {
|
|
2290
|
+
constructor(type, map, originalEvent) {
|
|
2291
|
+
super(type, map, originalEvent);
|
|
2269
2292
|
}
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
* @example
|
|
2276
|
-
* // this
|
|
2277
|
-
* var point = Point.convert([0, 1]);
|
|
2278
|
-
* // is equivalent to
|
|
2279
|
-
* var point = new Point(0, 1);
|
|
2280
|
-
*/
|
|
2281
|
-
static convert(a) {
|
|
2282
|
-
if (a instanceof Point) {
|
|
2283
|
-
return a;
|
|
2284
|
-
}
|
|
2285
|
-
if (Array.isArray(a)) {
|
|
2286
|
-
return new Point(a[0], a[1]);
|
|
2287
|
-
}
|
|
2288
|
-
return a;
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
class MapMouseEvent extends maplibregl.MapMouseEvent {
|
|
2296
|
+
constructor(type, map, originalEvent, data = {}) {
|
|
2297
|
+
super(type, map, originalEvent, data);
|
|
2289
2298
|
}
|
|
2290
2299
|
}
|
|
2291
2300
|
|
|
@@ -4200,7 +4209,7 @@ function addPolyline(_0, _1) {
|
|
|
4200
4209
|
let data = options.data;
|
|
4201
4210
|
if (typeof data === "string") {
|
|
4202
4211
|
if (isUUID(data)) {
|
|
4203
|
-
data = `https://api.maptiler.com/data/${options.data}/features.json?key=${config.apiKey}`;
|
|
4212
|
+
data = `https://api.maptiler.com/data/${options.data}/features.json?key=${config$1.apiKey}`;
|
|
4204
4213
|
} else if (((_a = data.split(".").pop()) == null ? void 0 : _a.toLowerCase().trim()) === "gpx") {
|
|
4205
4214
|
const res = yield fetch(data, fetchOptions);
|
|
4206
4215
|
const gpxStr = yield res.text();
|
|
@@ -4324,7 +4333,7 @@ function addPolygon(map, options) {
|
|
|
4324
4333
|
if (options.data && !map.getSource(sourceId)) {
|
|
4325
4334
|
let data = options.data;
|
|
4326
4335
|
if (typeof data === "string" && isUUID(data)) {
|
|
4327
|
-
data = `https://api.maptiler.com/data/${data}/features.json?key=${config.apiKey}`;
|
|
4336
|
+
data = `https://api.maptiler.com/data/${data}/features.json?key=${config$1.apiKey}`;
|
|
4328
4337
|
}
|
|
4329
4338
|
map.addSource(sourceId, {
|
|
4330
4339
|
type: "geojson",
|
|
@@ -4415,24 +4424,13 @@ function addPolygon(map, options) {
|
|
|
4415
4424
|
if (map.hasImage(pattern)) {
|
|
4416
4425
|
addLayers(pattern);
|
|
4417
4426
|
} else {
|
|
4418
|
-
map.loadImage(
|
|
4419
|
-
pattern,
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
}
|
|
4426
|
-
if (!image) {
|
|
4427
|
-
console.error(
|
|
4428
|
-
`An image cannot be created from the pattern URL ${pattern}.`
|
|
4429
|
-
);
|
|
4430
|
-
return addLayers();
|
|
4431
|
-
}
|
|
4432
|
-
map.addImage(pattern, image);
|
|
4433
|
-
addLayers(pattern);
|
|
4434
|
-
}
|
|
4435
|
-
);
|
|
4427
|
+
map.loadImage(pattern).then((value) => {
|
|
4428
|
+
map.addImage(pattern, value.data);
|
|
4429
|
+
addLayers(pattern);
|
|
4430
|
+
}).catch((err) => {
|
|
4431
|
+
console.error("Could not load the pattern image.", err.message);
|
|
4432
|
+
return addLayers();
|
|
4433
|
+
});
|
|
4436
4434
|
}
|
|
4437
4435
|
} else {
|
|
4438
4436
|
addLayers();
|
|
@@ -4492,7 +4490,7 @@ function addPoint(map, options) {
|
|
|
4492
4490
|
if (options.data && !map.getSource(sourceId)) {
|
|
4493
4491
|
let data = options.data;
|
|
4494
4492
|
if (typeof data === "string" && isUUID(data)) {
|
|
4495
|
-
data = `https://api.maptiler.com/data/${data}/features.json?key=${config.apiKey}`;
|
|
4493
|
+
data = `https://api.maptiler.com/data/${data}/features.json?key=${config$1.apiKey}`;
|
|
4496
4494
|
}
|
|
4497
4495
|
map.addSource(sourceId, {
|
|
4498
4496
|
type: "geojson",
|
|
@@ -4758,7 +4756,7 @@ function addHeatmap(map, options) {
|
|
|
4758
4756
|
if (options.data && !map.getSource(sourceId)) {
|
|
4759
4757
|
let data = options.data;
|
|
4760
4758
|
if (typeof data === "string" && isUUID(data)) {
|
|
4761
|
-
data = `https://api.maptiler.com/data/${data}/features.json?key=${config.apiKey}`;
|
|
4759
|
+
data = `https://api.maptiler.com/data/${data}/features.json?key=${config$1.apiKey}`;
|
|
4762
4760
|
}
|
|
4763
4761
|
map.addSource(sourceId, {
|
|
4764
4762
|
type: "geojson",
|
|
@@ -4804,31 +4802,60 @@ const {
|
|
|
4804
4802
|
AJAXError,
|
|
4805
4803
|
prewarm,
|
|
4806
4804
|
clearPrewarmedResources,
|
|
4807
|
-
version,
|
|
4808
|
-
workerCount,
|
|
4809
|
-
maxParallelImageRequests,
|
|
4810
|
-
workerUrl,
|
|
4811
4805
|
addProtocol,
|
|
4812
|
-
removeProtocol
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4806
|
+
removeProtocol,
|
|
4807
|
+
Hash,
|
|
4808
|
+
Point,
|
|
4809
|
+
config,
|
|
4810
|
+
EdgeInsets,
|
|
4811
|
+
DragRotateHandler,
|
|
4812
|
+
DragPanHandler,
|
|
4813
|
+
TwoFingersTouchZoomRotateHandler,
|
|
4814
|
+
DoubleClickZoomHandler,
|
|
4815
|
+
TwoFingersTouchZoomHandler,
|
|
4816
|
+
TwoFingersTouchRotateHandler,
|
|
4817
|
+
getWorkerCount,
|
|
4818
|
+
setWorkerCount,
|
|
4819
|
+
getMaxParallelImageRequests,
|
|
4820
|
+
setMaxParallelImageRequests,
|
|
4821
|
+
getWorkerUrl,
|
|
4822
|
+
setWorkerUrl,
|
|
4823
|
+
addSourceType,
|
|
4824
|
+
importScriptInWorkers
|
|
4825
|
+
} = maplibregl;
|
|
4826
|
+
function getVersion() {
|
|
4827
|
+
return packagejson.version;
|
|
4828
|
+
}
|
|
4829
|
+
function getMapLibreVersion() {
|
|
4830
|
+
return maplibregl.getVersion();
|
|
4831
|
+
}
|
|
4832
|
+
console.log("maplibregl", maplibregl);
|
|
4833
|
+
const MapMLGL = maplibregl.Map;
|
|
4834
|
+
const MarkerMLGL = maplibregl.Marker;
|
|
4835
|
+
const PopupMLGL = maplibregl.Popup;
|
|
4836
|
+
const StyleMLGL = maplibregl.Style;
|
|
4837
|
+
const CanvasSourceMLGL = maplibregl.CanvasSource;
|
|
4838
|
+
const GeoJSONSourceMLGL = maplibregl.GeoJSONSource;
|
|
4839
|
+
const ImageSourceMLGL = maplibregl.ImageSource;
|
|
4840
|
+
const RasterTileSourceMLGL = maplibregl.RasterTileSource;
|
|
4841
|
+
const RasterDEMTileSourceMLGL = maplibregl.RasterDEMTileSource;
|
|
4842
|
+
const VectorTileSourceMLGL = maplibregl.VectorTileSource;
|
|
4843
|
+
const VideoSourceMLGL = maplibregl.VideoSource;
|
|
4844
|
+
maplibregl.NavigationControl;
|
|
4845
|
+
maplibregl.GeolocateControl;
|
|
4846
|
+
maplibregl.AttributionControl;
|
|
4847
|
+
maplibregl.LogoControl;
|
|
4848
|
+
maplibregl.ScaleControl;
|
|
4849
|
+
maplibregl.FullscreenControl;
|
|
4850
|
+
maplibregl.TerrainControl;
|
|
4851
|
+
const BoxZoomHandlerMLGL = maplibregl.BoxZoomHandler;
|
|
4852
|
+
const ScrollZoomHandlerMLGL = maplibregl.ScrollZoomHandler;
|
|
4853
|
+
const CooperativeGesturesHandlerMLGL = maplibregl.CooperativeGesturesHandler;
|
|
4854
|
+
const KeyboardHandlerMLGL = maplibregl.KeyboardHandler;
|
|
4855
|
+
const TwoFingersTouchPitchHandlerMLGL = maplibregl.TwoFingersTouchPitchHandler;
|
|
4856
|
+
const MapWheelEventMLGL = maplibregl.MapWheelEvent;
|
|
4857
|
+
const MapTouchEventMLGL = maplibregl.MapTouchEvent;
|
|
4858
|
+
const MapMouseEventMLGL = maplibregl.MapMouseEvent;
|
|
4832
4859
|
|
|
4833
|
-
export { AJAXError, AttributionControl, CanvasSource, CanvasSourceMLGL, ColorRamp, ColorRampCollection, Evented, FullscreenControl, GeoJSONSource, GeoJSONSourceMLGL, GeolocateControl, GeolocationType, ImageSource, ImageSourceMLGL, Language, LngLat, LngLatBounds, LogoControl, Map, MapMLGL, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerNavigationControl, MaptilerTerrainControl, Marker, MarkerMLGL, MercatorCoordinate, NavigationControl, Point, Popup, PopupMLGL, RasterDEMTileSource, RasterDEMTileSourceMLGL, RasterTileSource, RasterTileSourceMLGL, ScaleControl, SdkConfig, Style, StyleMLGL, TerrainControl, VectorTileSource, VectorTileSourceMLGL, VideoSource, VideoSourceMLGL, addProtocol, clearPrewarmedResources, config, getRTLTextPluginStatus, gpx, gpxOrKml, hasChildNodeWithName, helpers,
|
|
4860
|
+
export { AJAXError, AttributionControl, BoxZoomHandler, BoxZoomHandlerMLGL, CanvasSource, CanvasSourceMLGL, ColorRamp, ColorRampCollection, CooperativeGesturesHandler, CooperativeGesturesHandlerMLGL, DoubleClickZoomHandler, DragPanHandler, DragRotateHandler, EdgeInsets, Evented, FullscreenControl, GeoJSONSource, GeoJSONSourceMLGL, GeolocateControl, GeolocationType, Hash, ImageSource, ImageSourceMLGL, KeyboardHandler, KeyboardHandlerMLGL, Language, LngLat, LngLatBounds, LogoControl, Map, MapMLGL, MapMouseEvent, MapMouseEventMLGL, MapTouchEvent, MapTouchEventMLGL, MapWheelEvent, MapWheelEventMLGL, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerNavigationControl, MaptilerTerrainControl, Marker, MarkerMLGL, MercatorCoordinate, NavigationControl, Point, Popup, PopupMLGL, RasterDEMTileSource, RasterDEMTileSourceMLGL, RasterTileSource, RasterTileSourceMLGL, ScaleControl, ScrollZoomHandler, ScrollZoomHandlerMLGL, SdkConfig, Style, StyleMLGL, TerrainControl, TwoFingersTouchPitchHandler, TwoFingersTouchPitchHandlerMLGL, TwoFingersTouchRotateHandler, TwoFingersTouchZoomHandler, TwoFingersTouchZoomRotateHandler, VectorTileSource, VectorTileSourceMLGL, VideoSource, VideoSourceMLGL, addProtocol, addSourceType, clearPrewarmedResources, config$1 as config, config as configMLGL, getBrowserLanguage, getMapLibreVersion, getMaxParallelImageRequests, getRTLTextPluginStatus, getVersion, getWorkerCount, getWorkerUrl, gpx, gpxOrKml, hasChildNodeWithName, helpers, importScriptInWorkers, isLanguageSupported, kml, prewarm, removeProtocol, setMaxParallelImageRequests, setRTLTextPlugin, setWorkerCount, setWorkerUrl, str2xml, xml2str };
|
|
4834
4861
|
//# sourceMappingURL=maptiler-sdk.mjs.map
|