@maptiler/sdk 1.0.7 → 1.0.9
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/CHANGELOG.md +55 -0
- package/demos/maptiler-sdk.umd.js +240 -79
- package/demos/simple.html +3 -2
- package/dist/maptiler-sdk.d.ts +200 -30
- package/dist/maptiler-sdk.min.mjs +1 -1
- package/dist/maptiler-sdk.mjs +144 -45
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/maptiler-sdk.umd.js +240 -79
- package/dist/maptiler-sdk.umd.js.map +1 -1
- package/dist/maptiler-sdk.umd.min.js +30 -30
- package/package.json +2 -2
- package/readme.md +9 -5
- package/src/AttributionControl.ts +13 -0
- package/src/CanvasSource.ts +13 -0
- package/src/FullscreenControl.ts +13 -0
- package/src/GeoJSONSource.ts +13 -0
- package/src/GeolocateControl.ts +13 -0
- package/src/ImageSource.ts +13 -0
- package/src/LogoControl.ts +13 -0
- package/src/Map.ts +36 -43
- package/src/MaptilerGeolocateControl.ts +1 -1
- package/src/MaptilerLogoControl.ts +2 -1
- package/src/MaptilerNavigationControl.ts +2 -2
- package/src/Marker.ts +13 -0
- package/src/NavigationControl.ts +13 -0
- package/src/Popup.ts +13 -0
- package/src/RasterDEMTileSource.ts +13 -0
- package/src/RasterTileSource.ts +13 -0
- package/src/ScaleControl.ts +13 -0
- package/src/Style.ts +13 -0
- package/src/TerrainControl.ts +13 -0
- package/src/VectorTileSource.ts +13 -0
- package/src/VideoSource.ts +13 -0
- package/src/index.ts +111 -35
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,59 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
## [v1.0.9](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.0.9)
|
|
3
|
+
- FIX: if the geolocate option is missing from `Map` constructor, then it's considered `false`
|
|
4
|
+
|
|
5
|
+
- FIX: The instance types for the following MapLibre classes are now fully exported:
|
|
6
|
+
- `NavigationControl`
|
|
7
|
+
- `GeolocateControl`
|
|
8
|
+
- `AttributionControl`
|
|
9
|
+
- `LogoControl`
|
|
10
|
+
- `ScaleControl`
|
|
11
|
+
- `FullscreenControl`
|
|
12
|
+
- `TerrainControl`
|
|
13
|
+
- `Popup`
|
|
14
|
+
- `Marker`
|
|
15
|
+
- `Style`
|
|
16
|
+
- `LngLat`
|
|
17
|
+
- `LngLatBounds`
|
|
18
|
+
- `MercatorCoordinate`
|
|
19
|
+
- `Evented`
|
|
20
|
+
- `AJAXError`
|
|
21
|
+
- `CanvasSource`
|
|
22
|
+
- `GeoJSONSource`
|
|
23
|
+
- `ImageSource`
|
|
24
|
+
- `RasterDEMTileSource`
|
|
25
|
+
- `RasterTileSource`
|
|
26
|
+
- `VectorTileSource`
|
|
27
|
+
- `VideoSource`
|
|
28
|
+
- `MapMLGL`
|
|
29
|
+
|
|
30
|
+
- FIX: The following class have been extended to provide greater compatibility with SDK,s MapL
|
|
31
|
+
- `Popup`
|
|
32
|
+
- `Marker`
|
|
33
|
+
- `Style`
|
|
34
|
+
- `CanvasSource`
|
|
35
|
+
- `GeoJSONSource`
|
|
36
|
+
- `ImageSource`
|
|
37
|
+
- `RasterDEMTileSource`
|
|
38
|
+
- `RasterTileSource`
|
|
39
|
+
- `VectorTileSource`
|
|
40
|
+
- `VideoSource`
|
|
41
|
+
- `NavigationControl`
|
|
42
|
+
- `GeolocateControl`
|
|
43
|
+
- `AttributionControl`
|
|
44
|
+
- `LogoControl`
|
|
45
|
+
- `ScaleControl`
|
|
46
|
+
- `FullscreenControl`
|
|
47
|
+
- `TerrainControl`
|
|
48
|
+
|
|
49
|
+
- ADD: new styles:
|
|
50
|
+
- `MapStyle.STREETS.NIGHT`
|
|
51
|
+
- `MapStyle.WINTER.DARK`
|
|
52
|
+
- `MapStyle.OUTDOOR.DARK`
|
|
53
|
+
|
|
54
|
+
## [v1.0.8](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.0.8)
|
|
55
|
+
- FIX: Since v1.0.7, the `Map` primary language (when custom) was no longer persistant on style update.
|
|
56
|
+
|
|
2
57
|
## [v1.0.7](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.0.7)
|
|
3
58
|
- The `apiKey` can now be specified in the `Map` constructor (will propagate to `config`)
|
|
4
59
|
- The `language` can now be speficifed in the `Map` constructo (will **not** propagete to `config` and will apply only to this specific instance)
|
|
@@ -1156,6 +1156,30 @@
|
|
|
1156
1156
|
400: "Query too long / Invalid parameters",
|
|
1157
1157
|
403: "Key is missing, invalid or restricted"
|
|
1158
1158
|
};
|
|
1159
|
+
function addLanguageGeocodingOptions(searchParams, options) {
|
|
1160
|
+
if (options.language == void 0) {
|
|
1161
|
+
return;
|
|
1162
|
+
}
|
|
1163
|
+
const languages = Array.from(
|
|
1164
|
+
new Set(
|
|
1165
|
+
(Array.isArray(options.language) ? options.language : [options.language]).map(
|
|
1166
|
+
(lang) => lang === LanguageGeocoding.AUTO ? getAutoLanguageGeocoding() : lang
|
|
1167
|
+
)
|
|
1168
|
+
)
|
|
1169
|
+
).join(",");
|
|
1170
|
+
searchParams.set("language", languages);
|
|
1171
|
+
}
|
|
1172
|
+
function addCommonForwardAndReverseGeocodingOptions(searchParams, options) {
|
|
1173
|
+
var _a;
|
|
1174
|
+
searchParams.set("key", (_a = options.apiKey) != null ? _a : config$1.apiKey);
|
|
1175
|
+
if (options.limit != void 0) {
|
|
1176
|
+
searchParams.set("limit", String(options.limit));
|
|
1177
|
+
}
|
|
1178
|
+
if (options.types != void 0) {
|
|
1179
|
+
searchParams.set("types", options.types.join(","));
|
|
1180
|
+
}
|
|
1181
|
+
addLanguageGeocodingOptions(searchParams, options);
|
|
1182
|
+
}
|
|
1159
1183
|
function forward(_0) {
|
|
1160
1184
|
return __async$3(this, arguments, function* (query, options = {}) {
|
|
1161
1185
|
var _a;
|
|
@@ -1166,30 +1190,27 @@
|
|
|
1166
1190
|
`geocoding/${encodeURIComponent(query)}.json`,
|
|
1167
1191
|
defaults$1.maptilerApiURL
|
|
1168
1192
|
);
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1193
|
+
const { searchParams } = endpoint;
|
|
1194
|
+
addCommonForwardAndReverseGeocodingOptions(searchParams, options);
|
|
1195
|
+
if (options.bbox != void 0) {
|
|
1196
|
+
searchParams.set("bbox", options.bbox.join(","));
|
|
1197
|
+
}
|
|
1198
|
+
if (options.proximity != void 0) {
|
|
1199
|
+
searchParams.set("proximity", options.proximity.join(","));
|
|
1200
|
+
}
|
|
1201
|
+
if (options.country != void 0) {
|
|
1202
|
+
searchParams.set("country", options.country.join(","));
|
|
1203
|
+
}
|
|
1204
|
+
if (options.fuzzyMatch != void 0) {
|
|
1205
|
+
searchParams.set("fuzzyMatch", options.fuzzyMatch ? "true" : "false");
|
|
1206
|
+
}
|
|
1207
|
+
if (options.autocomplete != void 0) {
|
|
1208
|
+
searchParams.set("autocomplete", options.autocomplete ? "true" : "false");
|
|
1185
1209
|
}
|
|
1186
1210
|
const urlWithParams = endpoint.toString();
|
|
1187
1211
|
const res = yield callFetch(urlWithParams);
|
|
1188
1212
|
if (!res.ok) {
|
|
1189
|
-
throw new ServiceError(
|
|
1190
|
-
res,
|
|
1191
|
-
res.status in customMessages$3 ? customMessages$3[res.status] : ""
|
|
1192
|
-
);
|
|
1213
|
+
throw new ServiceError(res, (_a = customMessages$3[res.status]) != null ? _a : "");
|
|
1193
1214
|
}
|
|
1194
1215
|
const obj = yield res.json();
|
|
1195
1216
|
return obj;
|
|
@@ -1205,24 +1226,25 @@
|
|
|
1205
1226
|
`geocoding/${position[0]},${position[1]}.json`,
|
|
1206
1227
|
defaults$1.maptilerApiURL
|
|
1207
1228
|
);
|
|
1208
|
-
endpoint.searchParams
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
(lang) => lang === LanguageGeocoding.AUTO ? getAutoLanguageGeocoding() : lang
|
|
1214
|
-
)
|
|
1215
|
-
)
|
|
1216
|
-
).join(",");
|
|
1217
|
-
endpoint.searchParams.set("language", languages);
|
|
1229
|
+
addCommonForwardAndReverseGeocodingOptions(endpoint.searchParams, options);
|
|
1230
|
+
const urlWithParams = endpoint.toString();
|
|
1231
|
+
const res = yield callFetch(urlWithParams);
|
|
1232
|
+
if (!res.ok) {
|
|
1233
|
+
throw new ServiceError(res, (_a = customMessages$3[res.status]) != null ? _a : "");
|
|
1218
1234
|
}
|
|
1235
|
+
const obj = yield res.json();
|
|
1236
|
+
return obj;
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1239
|
+
function byId(_0) {
|
|
1240
|
+
return __async$3(this, arguments, function* (id, options = {}) {
|
|
1241
|
+
var _a;
|
|
1242
|
+
const endpoint = new URL(`geocoding/${id}.json`, defaults$1.maptilerApiURL);
|
|
1243
|
+
addLanguageGeocodingOptions(endpoint.searchParams, options);
|
|
1219
1244
|
const urlWithParams = endpoint.toString();
|
|
1220
1245
|
const res = yield callFetch(urlWithParams);
|
|
1221
1246
|
if (!res.ok) {
|
|
1222
|
-
throw new ServiceError(
|
|
1223
|
-
res,
|
|
1224
|
-
res.status in customMessages$3 ? customMessages$3[res.status] : ""
|
|
1225
|
-
);
|
|
1247
|
+
throw new ServiceError(res, (_a = customMessages$3[res.status]) != null ? _a : "");
|
|
1226
1248
|
}
|
|
1227
1249
|
const obj = yield res.json();
|
|
1228
1250
|
return obj;
|
|
@@ -1231,6 +1253,7 @@
|
|
|
1231
1253
|
const geocoding = {
|
|
1232
1254
|
forward,
|
|
1233
1255
|
reverse,
|
|
1256
|
+
byId,
|
|
1234
1257
|
language: LanguageGeocoding
|
|
1235
1258
|
};
|
|
1236
1259
|
|
|
@@ -1618,6 +1641,13 @@
|
|
|
1618
1641
|
description: "",
|
|
1619
1642
|
imageURL: ""
|
|
1620
1643
|
},
|
|
1644
|
+
{
|
|
1645
|
+
id: "streets-v2-night",
|
|
1646
|
+
name: "Night",
|
|
1647
|
+
variantType: "NIGHT",
|
|
1648
|
+
description: "",
|
|
1649
|
+
imageURL: ""
|
|
1650
|
+
},
|
|
1621
1651
|
{
|
|
1622
1652
|
id: "streets-v2-pastel",
|
|
1623
1653
|
name: "Pastel",
|
|
@@ -1638,6 +1668,13 @@
|
|
|
1638
1668
|
variantType: "DEFAULT",
|
|
1639
1669
|
description: "",
|
|
1640
1670
|
imageURL: ""
|
|
1671
|
+
},
|
|
1672
|
+
{
|
|
1673
|
+
id: "outdoor-v2-dark",
|
|
1674
|
+
name: "Dark",
|
|
1675
|
+
variantType: "DARK",
|
|
1676
|
+
description: "",
|
|
1677
|
+
imageURL: ""
|
|
1641
1678
|
}
|
|
1642
1679
|
]
|
|
1643
1680
|
},
|
|
@@ -1648,10 +1685,17 @@
|
|
|
1648
1685
|
variants: [
|
|
1649
1686
|
{
|
|
1650
1687
|
id: "winter-v2",
|
|
1651
|
-
name: "
|
|
1688
|
+
name: "Default",
|
|
1652
1689
|
variantType: "DEFAULT",
|
|
1653
1690
|
description: "",
|
|
1654
1691
|
imageURL: ""
|
|
1692
|
+
},
|
|
1693
|
+
{
|
|
1694
|
+
id: "winter-v2-dark",
|
|
1695
|
+
name: "Dark",
|
|
1696
|
+
variantType: "DARK",
|
|
1697
|
+
description: "",
|
|
1698
|
+
imageURL: ""
|
|
1655
1699
|
}
|
|
1656
1700
|
]
|
|
1657
1701
|
},
|
|
@@ -1772,6 +1816,13 @@
|
|
|
1772
1816
|
description: "",
|
|
1773
1817
|
imageURL: ""
|
|
1774
1818
|
},
|
|
1819
|
+
{
|
|
1820
|
+
id: "topo-v2-dark",
|
|
1821
|
+
name: "Dark",
|
|
1822
|
+
variantType: "DARK",
|
|
1823
|
+
description: "",
|
|
1824
|
+
imageURL: ""
|
|
1825
|
+
},
|
|
1775
1826
|
{
|
|
1776
1827
|
id: "topo-v2-shiny",
|
|
1777
1828
|
name: "Shiny",
|
|
@@ -2248,7 +2299,13 @@
|
|
|
2248
2299
|
};
|
|
2249
2300
|
Object.freeze(defaults);
|
|
2250
2301
|
|
|
2251
|
-
class
|
|
2302
|
+
class LogoControl extends maplibregl.LogoControl {
|
|
2303
|
+
onAdd(map) {
|
|
2304
|
+
return super.onAdd(map);
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
class MaptilerLogoControl extends LogoControl {
|
|
2252
2309
|
constructor(options = {}) {
|
|
2253
2310
|
var _a, _b;
|
|
2254
2311
|
super(options);
|
|
@@ -2393,7 +2450,13 @@
|
|
|
2393
2450
|
}
|
|
2394
2451
|
}
|
|
2395
2452
|
|
|
2396
|
-
class
|
|
2453
|
+
class NavigationControl extends maplibregl.NavigationControl {
|
|
2454
|
+
onAdd(map) {
|
|
2455
|
+
return super.onAdd(map);
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
class MaptilerNavigationControl extends NavigationControl {
|
|
2397
2460
|
constructor() {
|
|
2398
2461
|
super({
|
|
2399
2462
|
showCompass: true,
|
|
@@ -2433,6 +2496,12 @@
|
|
|
2433
2496
|
}
|
|
2434
2497
|
}
|
|
2435
2498
|
|
|
2499
|
+
class GeolocateControl extends maplibregl.GeolocateControl {
|
|
2500
|
+
onAdd(map) {
|
|
2501
|
+
return super.onAdd(map);
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2436
2505
|
var __defProp$1 = Object.defineProperty;
|
|
2437
2506
|
var __defProps$1 = Object.defineProperties;
|
|
2438
2507
|
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
@@ -2452,10 +2521,9 @@
|
|
|
2452
2521
|
return a;
|
|
2453
2522
|
};
|
|
2454
2523
|
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
2455
|
-
const GeolocateControl$1 = maplibregl.GeolocateControl;
|
|
2456
2524
|
const Marker$1 = maplibregl.Marker;
|
|
2457
2525
|
const LngLat$1 = maplibregl.LngLat;
|
|
2458
|
-
class MaptilerGeolocateControl extends GeolocateControl
|
|
2526
|
+
class MaptilerGeolocateControl extends GeolocateControl {
|
|
2459
2527
|
constructor() {
|
|
2460
2528
|
super(...arguments);
|
|
2461
2529
|
this.lastUpdatedCenter = new LngLat$1(0, 0);
|
|
@@ -2597,6 +2665,24 @@
|
|
|
2597
2665
|
}
|
|
2598
2666
|
}
|
|
2599
2667
|
|
|
2668
|
+
class AttributionControl extends maplibregl.AttributionControl {
|
|
2669
|
+
onAdd(map) {
|
|
2670
|
+
return super.onAdd(map);
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
|
|
2674
|
+
class ScaleControl extends maplibregl.ScaleControl {
|
|
2675
|
+
onAdd(map) {
|
|
2676
|
+
return super.onAdd(map);
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
class FullscreenControl extends maplibregl.FullscreenControl {
|
|
2681
|
+
onAdd(map) {
|
|
2682
|
+
return super.onAdd(map);
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2600
2686
|
var __defProp = Object.defineProperty;
|
|
2601
2687
|
var __defProps = Object.defineProperties;
|
|
2602
2688
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -2643,7 +2729,7 @@
|
|
|
2643
2729
|
};
|
|
2644
2730
|
class Map$1 extends maplibregl.Map {
|
|
2645
2731
|
constructor(options) {
|
|
2646
|
-
var _a;
|
|
2732
|
+
var _a, _b;
|
|
2647
2733
|
if (options.apiKey) {
|
|
2648
2734
|
config.apiKey = options.apiKey;
|
|
2649
2735
|
}
|
|
@@ -2681,12 +2767,14 @@
|
|
|
2681
2767
|
};
|
|
2682
2768
|
}
|
|
2683
2769
|
}));
|
|
2684
|
-
this.languageShouldUpdate = false;
|
|
2685
|
-
this.isStyleInitialized = false;
|
|
2686
2770
|
this.isTerrainEnabled = false;
|
|
2687
2771
|
this.terrainExaggeration = 1;
|
|
2772
|
+
this.primaryLanguage = null;
|
|
2773
|
+
this.secondaryLanguage = null;
|
|
2774
|
+
this.primaryLanguage = (_a = options.language) != null ? _a : config.primaryLanguage;
|
|
2775
|
+
this.secondaryLanguage = config.secondaryLanguage;
|
|
2688
2776
|
this.once("styledata", () => __async(this, null, function* () {
|
|
2689
|
-
if (options.geolocate
|
|
2777
|
+
if (!options.geolocate) {
|
|
2690
2778
|
return;
|
|
2691
2779
|
}
|
|
2692
2780
|
if (options.center) {
|
|
@@ -2734,22 +2822,9 @@
|
|
|
2734
2822
|
);
|
|
2735
2823
|
}
|
|
2736
2824
|
}));
|
|
2737
|
-
this.on("styledataloading", () => {
|
|
2738
|
-
this.languageShouldUpdate = !!config.primaryLanguage || !!config.secondaryLanguage;
|
|
2739
|
-
});
|
|
2740
|
-
let initLanguageFromConstructor = true;
|
|
2741
2825
|
this.on("styledata", () => {
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
} else if (config.primaryLanguage && (this.languageShouldUpdate || !this.isStyleInitialized)) {
|
|
2745
|
-
this.setPrimaryLanguage(config.primaryLanguage);
|
|
2746
|
-
}
|
|
2747
|
-
if (config.secondaryLanguage && (this.languageShouldUpdate || !this.isStyleInitialized)) {
|
|
2748
|
-
this.setSecondaryLanguage(config.secondaryLanguage);
|
|
2749
|
-
}
|
|
2750
|
-
this.languageShouldUpdate = false;
|
|
2751
|
-
this.isStyleInitialized = true;
|
|
2752
|
-
initLanguageFromConstructor = false;
|
|
2826
|
+
this.setPrimaryLanguage(this.primaryLanguage);
|
|
2827
|
+
this.setSecondaryLanguage(this.secondaryLanguage);
|
|
2753
2828
|
});
|
|
2754
2829
|
this.on("styledata", () => {
|
|
2755
2830
|
if (this.getTerrain() === null && this.isTerrainEnabled) {
|
|
@@ -2782,14 +2857,14 @@
|
|
|
2782
2857
|
options.logoPosition
|
|
2783
2858
|
);
|
|
2784
2859
|
if (options.attributionControl === false) {
|
|
2785
|
-
this.addControl(new
|
|
2860
|
+
this.addControl(new AttributionControl(options));
|
|
2786
2861
|
}
|
|
2787
2862
|
} else if (options.maptilerLogo) {
|
|
2788
2863
|
this.addControl(new MaptilerLogoControl(), options.logoPosition);
|
|
2789
2864
|
}
|
|
2790
2865
|
if (options.scaleControl) {
|
|
2791
2866
|
const position = options.scaleControl === true || options.scaleControl === void 0 ? "bottom-right" : options.scaleControl;
|
|
2792
|
-
const scaleControl = new
|
|
2867
|
+
const scaleControl = new ScaleControl({ unit: config.unit });
|
|
2793
2868
|
this.addControl(scaleControl, position);
|
|
2794
2869
|
config.on("unit", (unit) => {
|
|
2795
2870
|
scaleControl.setUnit(unit);
|
|
@@ -2824,12 +2899,12 @@
|
|
|
2824
2899
|
}
|
|
2825
2900
|
if (options.fullscreenControl) {
|
|
2826
2901
|
const position = options.fullscreenControl === true || options.fullscreenControl === void 0 ? "top-right" : options.fullscreenControl;
|
|
2827
|
-
this.addControl(new
|
|
2902
|
+
this.addControl(new FullscreenControl({}), position);
|
|
2828
2903
|
}
|
|
2829
2904
|
}));
|
|
2830
2905
|
if (options.terrain) {
|
|
2831
2906
|
this.enableTerrain(
|
|
2832
|
-
(
|
|
2907
|
+
(_b = options.terrainExaggeration) != null ? _b : this.terrainExaggeration
|
|
2833
2908
|
);
|
|
2834
2909
|
}
|
|
2835
2910
|
}
|
|
@@ -2846,6 +2921,7 @@
|
|
|
2846
2921
|
if (!isLanguageSupported(language)) {
|
|
2847
2922
|
return;
|
|
2848
2923
|
}
|
|
2924
|
+
this.primaryLanguage = language;
|
|
2849
2925
|
this.onStyleReady(() => {
|
|
2850
2926
|
if (language === Language.AUTO) {
|
|
2851
2927
|
return this.setPrimaryLanguage(getBrowserLanguage());
|
|
@@ -2919,6 +2995,7 @@
|
|
|
2919
2995
|
if (!isLanguageSupported(language)) {
|
|
2920
2996
|
return;
|
|
2921
2997
|
}
|
|
2998
|
+
this.secondaryLanguage = language;
|
|
2922
2999
|
this.onStyleReady(() => {
|
|
2923
3000
|
if (language === Language.AUTO) {
|
|
2924
3001
|
return this.setSecondaryLanguage(getBrowserLanguage());
|
|
@@ -2978,6 +3055,12 @@
|
|
|
2978
3055
|
}
|
|
2979
3056
|
});
|
|
2980
3057
|
}
|
|
3058
|
+
getPrimaryLanguage() {
|
|
3059
|
+
return this.primaryLanguage;
|
|
3060
|
+
}
|
|
3061
|
+
getSecondaryLanguage() {
|
|
3062
|
+
return this.secondaryLanguage;
|
|
3063
|
+
}
|
|
2981
3064
|
getTerrainExaggeration() {
|
|
2982
3065
|
return this.terrainExaggeration;
|
|
2983
3066
|
}
|
|
@@ -3075,6 +3158,72 @@
|
|
|
3075
3158
|
}
|
|
3076
3159
|
}
|
|
3077
3160
|
|
|
3161
|
+
class Marker extends maplibregl.Marker {
|
|
3162
|
+
addTo(map) {
|
|
3163
|
+
return super.addTo(map);
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3167
|
+
class Popup extends maplibregl.Popup {
|
|
3168
|
+
addTo(map) {
|
|
3169
|
+
return super.addTo(map);
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
class Style extends maplibregl.Style {
|
|
3174
|
+
constructor(map, options = {}) {
|
|
3175
|
+
super(map, options);
|
|
3176
|
+
}
|
|
3177
|
+
}
|
|
3178
|
+
|
|
3179
|
+
class CanvasSource extends maplibregl.CanvasSource {
|
|
3180
|
+
onAdd(map) {
|
|
3181
|
+
super.onAdd(map);
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
class GeoJSONSource extends maplibregl.GeoJSONSource {
|
|
3186
|
+
onAdd(map) {
|
|
3187
|
+
super.onAdd(map);
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3190
|
+
|
|
3191
|
+
class ImageSource extends maplibregl.ImageSource {
|
|
3192
|
+
onAdd(map) {
|
|
3193
|
+
super.onAdd(map);
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
|
|
3197
|
+
class RasterTileSource extends maplibregl.RasterTileSource {
|
|
3198
|
+
onAdd(map) {
|
|
3199
|
+
super.onAdd(map);
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
|
|
3203
|
+
class RasterDEMTileSource extends maplibregl.RasterDEMTileSource {
|
|
3204
|
+
onAdd(map) {
|
|
3205
|
+
super.onAdd(map);
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
|
|
3209
|
+
class VectorTileSource extends maplibregl.VectorTileSource {
|
|
3210
|
+
onAdd(map) {
|
|
3211
|
+
super.onAdd(map);
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3214
|
+
|
|
3215
|
+
class VideoSource extends maplibregl.VideoSource {
|
|
3216
|
+
onAdd(map) {
|
|
3217
|
+
super.onAdd(map);
|
|
3218
|
+
}
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
class TerrainControl extends maplibregl.TerrainControl {
|
|
3222
|
+
onAdd(map) {
|
|
3223
|
+
return super.onAdd(map);
|
|
3224
|
+
}
|
|
3225
|
+
}
|
|
3226
|
+
|
|
3078
3227
|
class Point {
|
|
3079
3228
|
constructor(x, y) {
|
|
3080
3229
|
this.x = x;
|
|
@@ -3230,28 +3379,11 @@
|
|
|
3230
3379
|
supported,
|
|
3231
3380
|
setRTLTextPlugin,
|
|
3232
3381
|
getRTLTextPluginStatus,
|
|
3233
|
-
NavigationControl,
|
|
3234
|
-
GeolocateControl,
|
|
3235
|
-
AttributionControl,
|
|
3236
|
-
LogoControl,
|
|
3237
|
-
ScaleControl,
|
|
3238
|
-
FullscreenControl,
|
|
3239
|
-
TerrainControl,
|
|
3240
|
-
Popup,
|
|
3241
|
-
Marker,
|
|
3242
|
-
Style,
|
|
3243
3382
|
LngLat,
|
|
3244
3383
|
LngLatBounds,
|
|
3245
3384
|
MercatorCoordinate,
|
|
3246
3385
|
Evented,
|
|
3247
3386
|
AJAXError,
|
|
3248
|
-
CanvasSource,
|
|
3249
|
-
GeoJSONSource,
|
|
3250
|
-
ImageSource,
|
|
3251
|
-
RasterDEMTileSource,
|
|
3252
|
-
RasterTileSource,
|
|
3253
|
-
VectorTileSource,
|
|
3254
|
-
VideoSource,
|
|
3255
3387
|
prewarm,
|
|
3256
3388
|
clearPrewarmedResources,
|
|
3257
3389
|
version,
|
|
@@ -3262,42 +3394,71 @@
|
|
|
3262
3394
|
addProtocol,
|
|
3263
3395
|
removeProtocol
|
|
3264
3396
|
} = maplibregl;
|
|
3397
|
+
const MapMLGL = maplibregl.Map;
|
|
3398
|
+
const MarkerMLGL = maplibregl.Marker;
|
|
3399
|
+
const PopupMLGL = maplibregl.Popup;
|
|
3400
|
+
const StyleMLGL = maplibregl.Style;
|
|
3401
|
+
const CanvasSourceMLGL = maplibregl.CanvasSource;
|
|
3402
|
+
const GeoJSONSourceMLGL = maplibregl.GeoJSONSource;
|
|
3403
|
+
const ImageSourceMLGL = maplibregl.ImageSource;
|
|
3404
|
+
const RasterTileSourceMLGL = maplibregl.RasterTileSource;
|
|
3405
|
+
const RasterDEMTileSourceMLGL = maplibregl.RasterDEMTileSource;
|
|
3406
|
+
const VectorTileSourceMLGL = maplibregl.VectorTileSource;
|
|
3407
|
+
const VideoSourceMLGL = maplibregl.VideoSource;
|
|
3408
|
+
maplibregl.NavigationControl;
|
|
3409
|
+
maplibregl.GeolocateControl;
|
|
3410
|
+
maplibregl.AttributionControl;
|
|
3411
|
+
maplibregl.LogoControl;
|
|
3412
|
+
maplibregl.ScaleControl;
|
|
3413
|
+
maplibregl.FullscreenControl;
|
|
3414
|
+
maplibregl.TerrainControl;
|
|
3265
3415
|
|
|
3266
3416
|
exports.AJAXError = AJAXError;
|
|
3267
3417
|
exports.AttributionControl = AttributionControl;
|
|
3268
3418
|
exports.CanvasSource = CanvasSource;
|
|
3419
|
+
exports.CanvasSourceMLGL = CanvasSourceMLGL;
|
|
3269
3420
|
exports.Evented = Evented;
|
|
3270
3421
|
exports.FullscreenControl = FullscreenControl;
|
|
3271
3422
|
exports.GeoJSONSource = GeoJSONSource;
|
|
3423
|
+
exports.GeoJSONSourceMLGL = GeoJSONSourceMLGL;
|
|
3272
3424
|
exports.GeolocateControl = GeolocateControl;
|
|
3273
3425
|
exports.GeolocationType = GeolocationType;
|
|
3274
3426
|
exports.ImageSource = ImageSource;
|
|
3427
|
+
exports.ImageSourceMLGL = ImageSourceMLGL;
|
|
3275
3428
|
exports.Language = Language;
|
|
3276
3429
|
exports.LanguageGeocoding = LanguageGeocoding;
|
|
3277
3430
|
exports.LngLat = LngLat;
|
|
3278
3431
|
exports.LngLatBounds = LngLatBounds;
|
|
3279
3432
|
exports.LogoControl = LogoControl;
|
|
3280
3433
|
exports.Map = Map$1;
|
|
3434
|
+
exports.MapMLGL = MapMLGL;
|
|
3281
3435
|
exports.MapStyle = MapStyle;
|
|
3282
3436
|
exports.MapStyleVariant = MapStyleVariant;
|
|
3283
3437
|
exports.MaptilerGeolocateControl = MaptilerGeolocateControl;
|
|
3284
3438
|
exports.MaptilerLogoControl = MaptilerLogoControl;
|
|
3285
3439
|
exports.MaptilerTerrainControl = MaptilerTerrainControl;
|
|
3286
3440
|
exports.Marker = Marker;
|
|
3441
|
+
exports.MarkerMLGL = MarkerMLGL;
|
|
3287
3442
|
exports.MercatorCoordinate = MercatorCoordinate;
|
|
3288
3443
|
exports.NavigationControl = NavigationControl;
|
|
3289
3444
|
exports.Point = Point;
|
|
3290
3445
|
exports.Popup = Popup;
|
|
3446
|
+
exports.PopupMLGL = PopupMLGL;
|
|
3291
3447
|
exports.RasterDEMTileSource = RasterDEMTileSource;
|
|
3448
|
+
exports.RasterDEMTileSourceMLGL = RasterDEMTileSourceMLGL;
|
|
3292
3449
|
exports.RasterTileSource = RasterTileSource;
|
|
3450
|
+
exports.RasterTileSourceMLGL = RasterTileSourceMLGL;
|
|
3293
3451
|
exports.ReferenceMapStyle = ReferenceMapStyle;
|
|
3294
3452
|
exports.ScaleControl = ScaleControl;
|
|
3295
3453
|
exports.SdkConfig = SdkConfig;
|
|
3296
3454
|
exports.ServiceError = ServiceError;
|
|
3297
3455
|
exports.Style = Style;
|
|
3456
|
+
exports.StyleMLGL = StyleMLGL;
|
|
3298
3457
|
exports.TerrainControl = TerrainControl;
|
|
3299
3458
|
exports.VectorTileSource = VectorTileSource;
|
|
3459
|
+
exports.VectorTileSourceMLGL = VectorTileSourceMLGL;
|
|
3300
3460
|
exports.VideoSource = VideoSource;
|
|
3461
|
+
exports.VideoSourceMLGL = VideoSourceMLGL;
|
|
3301
3462
|
exports.addProtocol = addProtocol;
|
|
3302
3463
|
exports.clearPrewarmedResources = clearPrewarmedResources;
|
|
3303
3464
|
exports.clearStorage = clearStorage;
|
package/demos/simple.html
CHANGED
|
@@ -36,15 +36,16 @@
|
|
|
36
36
|
<script src ="maptiler-sdk.umd.js"></script>
|
|
37
37
|
|
|
38
38
|
<script>
|
|
39
|
-
|
|
39
|
+
maptilersdk.config.apiKey = "YOUR_API_KEY";
|
|
40
40
|
|
|
41
41
|
const map = new maptilersdk.Map({
|
|
42
42
|
container: document.getElementById("map-container"),
|
|
43
|
+
style: maptilersdk.MapStyle.OUTDOOR.DARK,
|
|
43
44
|
hash: true,
|
|
44
|
-
maxPitch: 85,
|
|
45
45
|
scaleControl: true,
|
|
46
46
|
fullscreenControl: true,
|
|
47
47
|
terrainControl: true,
|
|
48
|
+
geolocate: true,
|
|
48
49
|
})
|
|
49
50
|
|
|
50
51
|
const styleDropDown = document.getElementById("mapstyles-picker")
|