@maptiler/sdk 1.0.9 → 1.0.11
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/.github/workflows/npm-publish.yml +0 -1
- package/CHANGELOG.md +14 -0
- package/demos/maptiler-sdk.umd.js +471 -32
- package/dist/maptiler-sdk.d.ts +89 -38
- package/dist/maptiler-sdk.min.mjs +1 -1
- package/dist/maptiler-sdk.mjs +456 -19
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/maptiler-sdk.umd.js +471 -32
- package/dist/maptiler-sdk.umd.js.map +1 -1
- package/dist/maptiler-sdk.umd.min.js +47 -47
- package/package.json +24 -26
- package/readme.md +108 -0
- package/src/Map.ts +291 -40
- package/src/index.ts +4 -26
- package/demos/embedded-config.html +0 -66
- package/demos/two-maps.html +0 -71
package/src/index.ts
CHANGED
|
@@ -14,13 +14,6 @@ const {
|
|
|
14
14
|
supported,
|
|
15
15
|
setRTLTextPlugin,
|
|
16
16
|
getRTLTextPluginStatus,
|
|
17
|
-
// NavigationControl,
|
|
18
|
-
// GeolocateControl,
|
|
19
|
-
// AttributionControl,
|
|
20
|
-
// LogoControl,
|
|
21
|
-
// ScaleControl,
|
|
22
|
-
// FullscreenControl,
|
|
23
|
-
// TerrainControl,
|
|
24
17
|
LngLat,
|
|
25
18
|
LngLatBounds,
|
|
26
19
|
MercatorCoordinate,
|
|
@@ -31,14 +24,9 @@ const {
|
|
|
31
24
|
version,
|
|
32
25
|
workerCount,
|
|
33
26
|
maxParallelImageRequests,
|
|
34
|
-
clearStorage,
|
|
35
27
|
workerUrl,
|
|
36
28
|
addProtocol,
|
|
37
29
|
removeProtocol,
|
|
38
|
-
// isSafari,
|
|
39
|
-
// getPerformanceMetrics,
|
|
40
|
-
// config,
|
|
41
|
-
// Point,
|
|
42
30
|
} = maplibregl;
|
|
43
31
|
|
|
44
32
|
// We still want to export maplibregl.Map, but as a different name
|
|
@@ -65,24 +53,14 @@ export {
|
|
|
65
53
|
supported,
|
|
66
54
|
setRTLTextPlugin,
|
|
67
55
|
getRTLTextPluginStatus,
|
|
68
|
-
// Map,
|
|
69
|
-
// NavigationControl,
|
|
70
|
-
// GeolocateControl,
|
|
71
|
-
// AttributionControl,
|
|
72
|
-
// LogoControl,
|
|
73
|
-
// ScaleControl,
|
|
74
|
-
// FullscreenControl,
|
|
75
|
-
// TerrainControl,
|
|
76
56
|
PopupMLGL,
|
|
77
57
|
MarkerMLGL,
|
|
78
58
|
StyleMLGL,
|
|
79
59
|
LngLat,
|
|
80
60
|
LngLatBounds,
|
|
81
|
-
// Point,
|
|
82
61
|
MercatorCoordinate,
|
|
83
62
|
Evented,
|
|
84
63
|
AJAXError,
|
|
85
|
-
// config,
|
|
86
64
|
CanvasSourceMLGL,
|
|
87
65
|
GeoJSONSourceMLGL,
|
|
88
66
|
ImageSourceMLGL,
|
|
@@ -95,13 +73,10 @@ export {
|
|
|
95
73
|
version,
|
|
96
74
|
workerCount,
|
|
97
75
|
maxParallelImageRequests,
|
|
98
|
-
clearStorage,
|
|
99
76
|
workerUrl,
|
|
100
77
|
addProtocol,
|
|
101
78
|
removeProtocol,
|
|
102
79
|
MapMLGL,
|
|
103
|
-
// isSafari,
|
|
104
|
-
// getPerformanceMetrics
|
|
105
80
|
};
|
|
106
81
|
|
|
107
82
|
// Exporting types of class instances from MapLibre:
|
|
@@ -135,7 +110,7 @@ export type MapMLGL = InstanceType<typeof MapMLGL>;
|
|
|
135
110
|
|
|
136
111
|
// SDK specific
|
|
137
112
|
import { Map, GeolocationType } from "./Map";
|
|
138
|
-
import type { MapOptions } from "./Map";
|
|
113
|
+
import type { MapOptions, LoadWithTerrainEvent } from "./Map";
|
|
139
114
|
|
|
140
115
|
import { Marker } from "./Marker";
|
|
141
116
|
import { Popup } from "./Popup";
|
|
@@ -159,6 +134,7 @@ import { TerrainControl } from "./TerrainControl";
|
|
|
159
134
|
import { MaptilerGeolocateControl } from "./MaptilerGeolocateControl";
|
|
160
135
|
import { MaptilerLogoControl } from "./MaptilerLogoControl";
|
|
161
136
|
import { MaptilerTerrainControl } from "./MaptilerTerrainControl";
|
|
137
|
+
import { MaptilerNavigationControl } from "./MaptilerNavigationControl";
|
|
162
138
|
|
|
163
139
|
// importing client functions to expose them as part of the SDK
|
|
164
140
|
import type {
|
|
@@ -198,6 +174,7 @@ import type { Unit } from "./unit";
|
|
|
198
174
|
// Exporting types
|
|
199
175
|
export type {
|
|
200
176
|
MapOptions,
|
|
177
|
+
LoadWithTerrainEvent,
|
|
201
178
|
GeocodingOptions,
|
|
202
179
|
BBox,
|
|
203
180
|
Position,
|
|
@@ -251,4 +228,5 @@ export {
|
|
|
251
228
|
MaptilerGeolocateControl,
|
|
252
229
|
MaptilerLogoControl,
|
|
253
230
|
MaptilerTerrainControl,
|
|
231
|
+
MaptilerNavigationControl,
|
|
254
232
|
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<html>
|
|
2
|
-
<head>
|
|
3
|
-
<title>MapTiler JS SDK example</title>
|
|
4
|
-
<style>
|
|
5
|
-
html, body {
|
|
6
|
-
margin: 0;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
#map-container {
|
|
10
|
-
position: absolute;
|
|
11
|
-
width: 100vw;
|
|
12
|
-
height: 100vh;
|
|
13
|
-
background: radial-gradient(circle, rgb(186 226 255) 5%, rgb(0 100 159) 98%);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
#style-picker-container {
|
|
17
|
-
position: absolute;
|
|
18
|
-
z-index: 2;
|
|
19
|
-
margin: 10px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
</style>
|
|
23
|
-
|
|
24
|
-
<link rel="stylesheet" href="maptiler-sdk.css">
|
|
25
|
-
</head>
|
|
26
|
-
|
|
27
|
-
<body>
|
|
28
|
-
<div id="map-container"></div>
|
|
29
|
-
<div id="style-picker-container">
|
|
30
|
-
<select name="mapstyles" id="mapstyles-picker">
|
|
31
|
-
|
|
32
|
-
</select>
|
|
33
|
-
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<script src ="maptiler-sdk.umd.js"></script>
|
|
37
|
-
|
|
38
|
-
<script>
|
|
39
|
-
const map = new maptilersdk.Map({
|
|
40
|
-
container: document.getElementById("map-container"),
|
|
41
|
-
apiKey: "ZFEK2gQSwT4Jcimbtcy7",
|
|
42
|
-
language: maptilersdk.Language.GERMAN,
|
|
43
|
-
hash: true,
|
|
44
|
-
maxPitch: 85,
|
|
45
|
-
scaleControl: true,
|
|
46
|
-
fullscreenControl: true,
|
|
47
|
-
terrainControl: true,
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
const styleDropDown = document.getElementById("mapstyles-picker")
|
|
51
|
-
|
|
52
|
-
styleDropDown.onchange = (evt) => {
|
|
53
|
-
map.setStyle(styleDropDown.value)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
Object.keys(maptilersdk.MapStyle).forEach(s => {
|
|
57
|
-
const styleOption = document.createElement('option');
|
|
58
|
-
styleOption.value = maptilersdk.MapStyle[s].DEFAULT.id;
|
|
59
|
-
styleOption.innerHTML = s.replace("_", " ").toLowerCase();
|
|
60
|
-
styleDropDown.appendChild(styleOption);
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
</script>
|
|
65
|
-
</body>
|
|
66
|
-
</html>
|
package/demos/two-maps.html
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
<html>
|
|
2
|
-
<head>
|
|
3
|
-
<title>MapTiler JS SDK example</title>
|
|
4
|
-
<style>
|
|
5
|
-
html, body {
|
|
6
|
-
margin: 0;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
#two-map-container {
|
|
10
|
-
display: inline-flex;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
#map-container1 {
|
|
14
|
-
/* position: absolute; */
|
|
15
|
-
width: 50vw;
|
|
16
|
-
height: 100vh;
|
|
17
|
-
background: radial-gradient(circle, rgb(186 226 255) 5%, rgb(0 100 159) 98%);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
#map-container2 {
|
|
21
|
-
/* position: absolute; */
|
|
22
|
-
width: 50vw;
|
|
23
|
-
height: 100vh;
|
|
24
|
-
background: radial-gradient(circle, rgb(186 226 255) 5%, rgb(0 100 159) 98%);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
</style>
|
|
28
|
-
|
|
29
|
-
<link rel="stylesheet" href="maptiler-sdk.css">
|
|
30
|
-
</head>
|
|
31
|
-
|
|
32
|
-
<body>
|
|
33
|
-
<div id="two-map-container">
|
|
34
|
-
<div id="map-container1"></div>
|
|
35
|
-
<div id="map-container2"></div>
|
|
36
|
-
</div>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<script src ="maptiler-sdk.umd.js"></script>
|
|
40
|
-
|
|
41
|
-
<script>
|
|
42
|
-
// maptilersdk.config.primaryLanguage = maptilersdk.Language.GERMAN;
|
|
43
|
-
|
|
44
|
-
const map1 = new maptilersdk.Map({
|
|
45
|
-
container: document.getElementById("map-container1"),
|
|
46
|
-
apiKey: "ZFEK2gQSwT4Jcimbtcy7",
|
|
47
|
-
language: maptilersdk.Language.SPANISH,
|
|
48
|
-
hash: true,
|
|
49
|
-
maxPitch: 85,
|
|
50
|
-
scaleControl: true,
|
|
51
|
-
fullscreenControl: true,
|
|
52
|
-
terrainControl: true,
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
const map2 = new maptilersdk.Map({
|
|
56
|
-
container: document.getElementById("map-container2"),
|
|
57
|
-
apiKey: "ZFEK2gQSwT4Jcimbtcy7",
|
|
58
|
-
hash: true,
|
|
59
|
-
maxPitch: 85,
|
|
60
|
-
scaleControl: true,
|
|
61
|
-
fullscreenControl: true,
|
|
62
|
-
terrainControl: true,
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
console.log('map1', map1);
|
|
66
|
-
console.log('map2', map2);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
</script>
|
|
70
|
-
</body>
|
|
71
|
-
</html>
|