@maptiler/sdk 1.0.8 → 1.0.10
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 +62 -0
- package/demos/maptiler-sdk.umd.js +693 -93
- package/demos/simple.html +3 -2
- package/dist/maptiler-sdk.d.ts +229 -42
- package/dist/maptiler-sdk.min.mjs +1 -1
- package/dist/maptiler-sdk.mjs +583 -46
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/maptiler-sdk.umd.js +693 -93
- package/dist/maptiler-sdk.umd.js.map +1 -1
- package/dist/maptiler-sdk.umd.min.js +47 -47
- package/package.json +25 -27
- package/readme.md +111 -0
- 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 +291 -49
- 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 +99 -47
- package/demos/embedded-config.html +0 -66
- package/demos/two-maps.html +0 -71
package/src/index.ts
CHANGED
|
@@ -14,89 +14,123 @@ 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
|
-
Popup,
|
|
25
|
-
Marker,
|
|
26
|
-
Style,
|
|
27
17
|
LngLat,
|
|
28
18
|
LngLatBounds,
|
|
29
19
|
MercatorCoordinate,
|
|
30
20
|
Evented,
|
|
31
21
|
AJAXError,
|
|
32
|
-
CanvasSource,
|
|
33
|
-
GeoJSONSource,
|
|
34
|
-
ImageSource,
|
|
35
|
-
RasterDEMTileSource,
|
|
36
|
-
RasterTileSource,
|
|
37
|
-
VectorTileSource,
|
|
38
|
-
VideoSource,
|
|
39
22
|
prewarm,
|
|
40
23
|
clearPrewarmedResources,
|
|
41
24
|
version,
|
|
42
25
|
workerCount,
|
|
43
26
|
maxParallelImageRequests,
|
|
44
|
-
clearStorage,
|
|
45
27
|
workerUrl,
|
|
46
28
|
addProtocol,
|
|
47
29
|
removeProtocol,
|
|
48
|
-
|
|
49
|
-
// isSafari,
|
|
50
|
-
// getPerformanceMetrics,
|
|
51
|
-
// config,
|
|
52
|
-
// Point,
|
|
53
30
|
} = maplibregl;
|
|
54
31
|
|
|
32
|
+
// We still want to export maplibregl.Map, but as a different name
|
|
33
|
+
const MapMLGL = maplibregl.Map;
|
|
34
|
+
const MarkerMLGL = maplibregl.Marker;
|
|
35
|
+
const PopupMLGL = maplibregl.Popup;
|
|
36
|
+
const StyleMLGL = maplibregl.Style;
|
|
37
|
+
const CanvasSourceMLGL = maplibregl.CanvasSource;
|
|
38
|
+
const GeoJSONSourceMLGL = maplibregl.GeoJSONSource;
|
|
39
|
+
const ImageSourceMLGL = maplibregl.ImageSource;
|
|
40
|
+
const RasterTileSourceMLGL = maplibregl.RasterTileSource;
|
|
41
|
+
const RasterDEMTileSourceMLGL = maplibregl.RasterDEMTileSource;
|
|
42
|
+
const VectorTileSourceMLGL = maplibregl.VectorTileSource;
|
|
43
|
+
const VideoSourceMLGL = maplibregl.VideoSource;
|
|
44
|
+
const NavigationControlMLGL = maplibregl.NavigationControl;
|
|
45
|
+
const GeolocateControlMLGL = maplibregl.GeolocateControl;
|
|
46
|
+
const AttributionControlMLGL = maplibregl.AttributionControl;
|
|
47
|
+
const LogoControlMLGL = maplibregl.LogoControl;
|
|
48
|
+
const ScaleControlMLGL = maplibregl.ScaleControl;
|
|
49
|
+
const FullscreenControlMLGL = maplibregl.FullscreenControl;
|
|
50
|
+
const TerrainControlMLGL = maplibregl.TerrainControl;
|
|
51
|
+
|
|
55
52
|
export {
|
|
56
53
|
supported,
|
|
57
54
|
setRTLTextPlugin,
|
|
58
55
|
getRTLTextPluginStatus,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
AttributionControl,
|
|
63
|
-
LogoControl,
|
|
64
|
-
ScaleControl,
|
|
65
|
-
FullscreenControl,
|
|
66
|
-
TerrainControl,
|
|
67
|
-
Popup,
|
|
68
|
-
Marker,
|
|
69
|
-
Style,
|
|
56
|
+
PopupMLGL,
|
|
57
|
+
MarkerMLGL,
|
|
58
|
+
StyleMLGL,
|
|
70
59
|
LngLat,
|
|
71
60
|
LngLatBounds,
|
|
72
|
-
// Point,
|
|
73
61
|
MercatorCoordinate,
|
|
74
62
|
Evented,
|
|
75
63
|
AJAXError,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
VideoSource,
|
|
64
|
+
CanvasSourceMLGL,
|
|
65
|
+
GeoJSONSourceMLGL,
|
|
66
|
+
ImageSourceMLGL,
|
|
67
|
+
RasterDEMTileSourceMLGL,
|
|
68
|
+
RasterTileSourceMLGL,
|
|
69
|
+
VectorTileSourceMLGL,
|
|
70
|
+
VideoSourceMLGL,
|
|
84
71
|
prewarm,
|
|
85
72
|
clearPrewarmedResources,
|
|
86
73
|
version,
|
|
87
74
|
workerCount,
|
|
88
75
|
maxParallelImageRequests,
|
|
89
|
-
clearStorage,
|
|
90
76
|
workerUrl,
|
|
91
77
|
addProtocol,
|
|
92
78
|
removeProtocol,
|
|
93
|
-
|
|
94
|
-
// getPerformanceMetrics
|
|
79
|
+
MapMLGL,
|
|
95
80
|
};
|
|
96
81
|
|
|
82
|
+
// Exporting types of class instances from MapLibre:
|
|
83
|
+
export type NavigationControlMLGL = InstanceType<typeof NavigationControlMLGL>;
|
|
84
|
+
export type GeolocateControlMLGL = InstanceType<typeof GeolocateControlMLGL>;
|
|
85
|
+
export type AttributionControlMLGL = InstanceType<
|
|
86
|
+
typeof AttributionControlMLGL
|
|
87
|
+
>;
|
|
88
|
+
export type LogoControlMLGL = InstanceType<typeof LogoControlMLGL>;
|
|
89
|
+
export type ScaleControlMLGL = InstanceType<typeof ScaleControlMLGL>;
|
|
90
|
+
export type FullscreenControlMLGL = InstanceType<typeof FullscreenControlMLGL>;
|
|
91
|
+
export type TerrainControlMLGL = InstanceType<typeof TerrainControlMLGL>;
|
|
92
|
+
export type MarkerMLGL = InstanceType<typeof MarkerMLGL>;
|
|
93
|
+
export type PopupMLGL = InstanceType<typeof PopupMLGL>;
|
|
94
|
+
export type StyleMLGL = InstanceType<typeof StyleMLGL>;
|
|
95
|
+
export type LngLat = InstanceType<typeof LngLat>;
|
|
96
|
+
export type LngLatBounds = InstanceType<typeof LngLatBounds>;
|
|
97
|
+
export type MercatorCoordinate = InstanceType<typeof MercatorCoordinate>;
|
|
98
|
+
export type Evented = InstanceType<typeof Evented>;
|
|
99
|
+
export type AJAXError = InstanceType<typeof AJAXError>;
|
|
100
|
+
export type CanvasSourceMLGL = InstanceType<typeof CanvasSourceMLGL>;
|
|
101
|
+
export type GeoJSONSourceMLGL = InstanceType<typeof GeoJSONSourceMLGL>;
|
|
102
|
+
export type ImageSourceMLGL = InstanceType<typeof ImageSourceMLGL>;
|
|
103
|
+
export type RasterDEMTileSourceMLGL = InstanceType<
|
|
104
|
+
typeof RasterDEMTileSourceMLGL
|
|
105
|
+
>;
|
|
106
|
+
export type RasterTileSourceMLGL = InstanceType<typeof RasterTileSourceMLGL>;
|
|
107
|
+
export type VectorTileSourceMLGL = InstanceType<typeof VectorTileSourceMLGL>;
|
|
108
|
+
export type VideoSourceMLGL = InstanceType<typeof VideoSourceMLGL>;
|
|
109
|
+
export type MapMLGL = InstanceType<typeof MapMLGL>;
|
|
110
|
+
|
|
111
|
+
// SDK specific
|
|
97
112
|
import { Map, GeolocationType } from "./Map";
|
|
98
|
-
import type { MapOptions } from "./Map";
|
|
113
|
+
import type { MapOptions, LoadWithTerrainEvent } from "./Map";
|
|
99
114
|
|
|
115
|
+
import { Marker } from "./Marker";
|
|
116
|
+
import { Popup } from "./Popup";
|
|
117
|
+
import { Style } from "./Style";
|
|
118
|
+
import { CanvasSource } from "./CanvasSource";
|
|
119
|
+
import { GeoJSONSource } from "./GeoJSONSource";
|
|
120
|
+
import { ImageSource } from "./ImageSource";
|
|
121
|
+
import { RasterTileSource } from "./RasterTileSource";
|
|
122
|
+
import { RasterDEMTileSource } from "./RasterDEMTileSource";
|
|
123
|
+
import { VectorTileSource } from "./VectorTileSource";
|
|
124
|
+
import { VideoSource } from "./VideoSource";
|
|
125
|
+
import { NavigationControl } from "./NavigationControl";
|
|
126
|
+
import { GeolocateControl } from "./GeolocateControl";
|
|
127
|
+
import { AttributionControl } from "./AttributionControl";
|
|
128
|
+
import { LogoControl } from "./LogoControl";
|
|
129
|
+
import { ScaleControl } from "./ScaleControl";
|
|
130
|
+
import { FullscreenControl } from "./FullscreenControl";
|
|
131
|
+
import { TerrainControl } from "./TerrainControl";
|
|
132
|
+
|
|
133
|
+
// Import of modified versions of the controls
|
|
100
134
|
import { MaptilerGeolocateControl } from "./MaptilerGeolocateControl";
|
|
101
135
|
import { MaptilerLogoControl } from "./MaptilerLogoControl";
|
|
102
136
|
import { MaptilerTerrainControl } from "./MaptilerTerrainControl";
|
|
@@ -139,6 +173,7 @@ import type { Unit } from "./unit";
|
|
|
139
173
|
// Exporting types
|
|
140
174
|
export type {
|
|
141
175
|
MapOptions,
|
|
176
|
+
LoadWithTerrainEvent,
|
|
142
177
|
GeocodingOptions,
|
|
143
178
|
BBox,
|
|
144
179
|
Position,
|
|
@@ -157,6 +192,23 @@ export type {
|
|
|
157
192
|
// Exporting classes, objects, functions, etc.
|
|
158
193
|
export {
|
|
159
194
|
Map,
|
|
195
|
+
Marker,
|
|
196
|
+
Popup,
|
|
197
|
+
Style,
|
|
198
|
+
CanvasSource,
|
|
199
|
+
GeoJSONSource,
|
|
200
|
+
ImageSource,
|
|
201
|
+
RasterTileSource,
|
|
202
|
+
RasterDEMTileSource,
|
|
203
|
+
VideoSource,
|
|
204
|
+
NavigationControl,
|
|
205
|
+
GeolocateControl,
|
|
206
|
+
AttributionControl,
|
|
207
|
+
LogoControl,
|
|
208
|
+
ScaleControl,
|
|
209
|
+
FullscreenControl,
|
|
210
|
+
TerrainControl,
|
|
211
|
+
VectorTileSource,
|
|
160
212
|
GeolocationType,
|
|
161
213
|
SdkConfig,
|
|
162
214
|
config,
|
|
@@ -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>
|