@maptiler/sdk 1.1.2 → 1.2.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 +15 -5
- package/.github/pull_request_template.md +11 -0
- package/.github/workflows/format-lint.yml +24 -0
- package/CHANGELOG.md +94 -51
- package/colorramp.md +93 -0
- package/dist/maptiler-sdk.d.ts +1207 -123
- package/dist/maptiler-sdk.min.mjs +3 -1
- package/dist/maptiler-sdk.mjs +3561 -485
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/maptiler-sdk.umd.js +3825 -869
- package/dist/maptiler-sdk.umd.js.map +1 -1
- package/dist/maptiler-sdk.umd.min.js +51 -49
- package/package.json +27 -13
- package/readme.md +298 -0
- package/rollup.config.js +2 -16
- package/src/Map.ts +489 -357
- package/src/MaptilerGeolocateControl.ts +23 -20
- package/src/MaptilerLogoControl.ts +3 -3
- package/src/MaptilerNavigationControl.ts +9 -6
- package/src/MaptilerTerrainControl.ts +15 -14
- package/src/Minimap.ts +373 -0
- package/src/Point.ts +3 -5
- package/src/colorramp.ts +1216 -0
- package/src/config.ts +4 -3
- package/src/converters/index.ts +1 -0
- package/src/converters/xml.ts +681 -0
- package/src/defaults.ts +1 -1
- package/src/helpers/index.ts +27 -0
- package/src/helpers/stylehelper.ts +395 -0
- package/src/helpers/vectorlayerhelpers.ts +1511 -0
- package/src/index.ts +10 -0
- package/src/language.ts +116 -79
- package/src/mapstyle.ts +4 -2
- package/src/tools.ts +68 -16
- package/tsconfig.json +8 -5
- package/vite.config.ts +10 -0
- package/demos/maptiler-sdk.css +0 -147
- package/demos/maptiler-sdk.umd.js +0 -4041
- package/demos/mountain.html +0 -67
- package/demos/simple.html +0 -67
- package/demos/transform-request.html +0 -81
package/demos/mountain.html
DELETED
|
@@ -1,67 +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
|
-
maptilersdk.config.apiKey = "YOUR_API_KEY";
|
|
40
|
-
|
|
41
|
-
const map = new maptilersdk.Map({
|
|
42
|
-
container: document.getElementById("map-container"),
|
|
43
|
-
style: maptilersdk.MapStyle.OUTDOOR.DARK,
|
|
44
|
-
hash: true,
|
|
45
|
-
scaleControl: true,
|
|
46
|
-
fullscreenControl: true,
|
|
47
|
-
terrainControl: true,
|
|
48
|
-
geolocate: true,
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
const styleDropDown = document.getElementById("mapstyles-picker")
|
|
52
|
-
|
|
53
|
-
styleDropDown.onchange = (evt) => {
|
|
54
|
-
map.setStyle(styleDropDown.value)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
Object.keys(maptilersdk.MapStyle).forEach(s => {
|
|
58
|
-
const styleOption = document.createElement('option');
|
|
59
|
-
styleOption.value = maptilersdk.MapStyle[s].DEFAULT.id;
|
|
60
|
-
styleOption.innerHTML = s.replace("_", " ").toLowerCase();
|
|
61
|
-
styleDropDown.appendChild(styleOption);
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
</script>
|
|
66
|
-
</body>
|
|
67
|
-
</html>
|
package/demos/simple.html
DELETED
|
@@ -1,67 +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
|
-
maptilersdk.config.apiKey = "YOUR_API_KEY";
|
|
40
|
-
|
|
41
|
-
const map = new maptilersdk.Map({
|
|
42
|
-
container: document.getElementById("map-container"),
|
|
43
|
-
style: maptilersdk.MapStyle.OUTDOOR.DARK,
|
|
44
|
-
hash: true,
|
|
45
|
-
scaleControl: true,
|
|
46
|
-
fullscreenControl: true,
|
|
47
|
-
terrainControl: true,
|
|
48
|
-
geolocate: true,
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
const styleDropDown = document.getElementById("mapstyles-picker")
|
|
52
|
-
|
|
53
|
-
styleDropDown.onchange = (evt) => {
|
|
54
|
-
map.setStyle(styleDropDown.value)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
Object.keys(maptilersdk.MapStyle).forEach(s => {
|
|
58
|
-
const styleOption = document.createElement('option');
|
|
59
|
-
styleOption.value = maptilersdk.MapStyle[s].DEFAULT.id;
|
|
60
|
-
styleOption.innerHTML = s.replace("_", " ").toLowerCase();
|
|
61
|
-
styleDropDown.appendChild(styleOption);
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
</script>
|
|
66
|
-
</body>
|
|
67
|
-
</html>
|
|
@@ -1,81 +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
|
-
maptilersdk.config.apiKey = "YOUR_API_KEY";
|
|
40
|
-
|
|
41
|
-
const map = new maptilersdk.Map({
|
|
42
|
-
container: document.getElementById("map-container"),
|
|
43
|
-
style: maptilersdk.MapStyle.OUTDOOR.DARK,
|
|
44
|
-
hash: true,
|
|
45
|
-
|
|
46
|
-
transformRequest: function(url) {
|
|
47
|
-
const reqUrl = new URL(url);
|
|
48
|
-
reqUrl.searchParams.append("some-extra-param", "some-extra-value");
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
url: reqUrl.href,
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
const styleDropDown = document.getElementById("mapstyles-picker")
|
|
57
|
-
|
|
58
|
-
styleDropDown.onchange = (evt) => {
|
|
59
|
-
map.setStyle(styleDropDown.value)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
Object.keys(maptilersdk.MapStyle).forEach(s => {
|
|
63
|
-
const styleOption = document.createElement('option');
|
|
64
|
-
styleOption.value = maptilersdk.MapStyle[s].DEFAULT.id;
|
|
65
|
-
styleOption.innerHTML = s.replace("_", " ").toLowerCase();
|
|
66
|
-
styleDropDown.appendChild(styleOption);
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
// This will end up being used instead of the one defined in the constructor
|
|
70
|
-
map.setTransformRequest((url) => {
|
|
71
|
-
const reqUrl = new URL(url);
|
|
72
|
-
reqUrl.searchParams.append("some-extra-param-two", "some-extra-value-two");
|
|
73
|
-
return {
|
|
74
|
-
url: reqUrl.href,
|
|
75
|
-
}
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
</script>
|
|
80
|
-
</body>
|
|
81
|
-
</html>
|