@maptiler/sdk 3.0.0-rc.4 → 3.0.0-rc.5
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/dist/maptiler-sdk.mjs +221 -203
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/src/Map.d.ts +4 -4
- package/dist/src/MaptilerGeolocateControl.d.ts +1 -0
- package/package.json +2 -2
- package/readme.md +35 -2
- package/vite.config-umd.ts +4 -10
package/dist/src/Map.d.ts
CHANGED
|
@@ -381,13 +381,13 @@ export declare class Map extends maplibregl.Map {
|
|
|
381
381
|
*/
|
|
382
382
|
isGlobeProjection(): boolean;
|
|
383
383
|
/**
|
|
384
|
-
*
|
|
384
|
+
* Activate the globe projection.
|
|
385
385
|
*/
|
|
386
|
-
enableGlobeProjection(
|
|
386
|
+
enableGlobeProjection(): void;
|
|
387
387
|
/**
|
|
388
|
-
*
|
|
388
|
+
* Activate the mercator projection.
|
|
389
389
|
*/
|
|
390
|
-
enableMercatorProjection(
|
|
390
|
+
enableMercatorProjection(): void;
|
|
391
391
|
/**
|
|
392
392
|
* Returns `true` is the language was ever updated, meaning changed
|
|
393
393
|
* from what is delivered in the style.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maptiler/sdk",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.5",
|
|
4
4
|
"description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud",
|
|
5
5
|
"module": "dist/maptiler-sdk.mjs",
|
|
6
6
|
"types": "dist/maptiler-sdk.d.ts",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@maptiler/client": "^2.2.0",
|
|
66
66
|
"events": "^3.3.0",
|
|
67
67
|
"js-base64": "^3.7.4",
|
|
68
|
-
"maplibre-gl": "^5.0.0-pre.
|
|
68
|
+
"maplibre-gl": "^5.0.0-pre.10",
|
|
69
69
|
"uuid": "^9.0.0"
|
|
70
70
|
}
|
|
71
71
|
}
|
package/readme.md
CHANGED
|
@@ -136,7 +136,7 @@ The SDK hosted on our CDN is bundled as *[Universal Module Definition](https://g
|
|
|
136
136
|
<body>
|
|
137
137
|
<div id="map-container"></div>
|
|
138
138
|
|
|
139
|
-
<script src ="dist/maptiler-sdk.umd.js"></script>
|
|
139
|
+
<script src ="dist/maptiler-sdk.umd.min.js"></script>
|
|
140
140
|
|
|
141
141
|
<script>
|
|
142
142
|
// Add your MapTiler Cloud API key to the config
|
|
@@ -1103,7 +1103,40 @@ Turning off *zoom compensation* allows for more accurate adjustments to the visu
|
|
|
1103
1103
|
|
|
1104
1104
|
All the other options are documented on [our reference page](https://docs.maptiler.com/sdk-js/api/helpers/#heatmap) and more examples are available [here](https://docs.maptiler.com/sdk-js/examples/?q=heatmap+helper).
|
|
1105
1105
|
|
|
1106
|
-
# Other
|
|
1106
|
+
# Other helpers
|
|
1107
|
+
## Convert GPX and KML to GeoJSON
|
|
1108
|
+
In the [Polyline helper section](#polyline-layer-helper) above, we have seen that one can feed the helper directly with a path to a GPX or KML file, that is then converted under the hood client-side into a GeoJSON `FeatureCollection` object. This conversion feature is also exposed and can be used as such:
|
|
1109
|
+
|
|
1110
|
+
```ts
|
|
1111
|
+
import { gpx } from "@maptiler/sdk";
|
|
1112
|
+
|
|
1113
|
+
// ... assuming inside an async function
|
|
1114
|
+
|
|
1115
|
+
// Fetching the GPX file as a string:
|
|
1116
|
+
const gpxFilePath = "some_gps_trace.gpx";
|
|
1117
|
+
const gpxResponse = await fetch(gpxFilePath);
|
|
1118
|
+
const gpxStr = await res.text();
|
|
1119
|
+
|
|
1120
|
+
// Converting the GPX payload into a GeoJSON FeatureCollection:
|
|
1121
|
+
const features = maptilersdk.gpx(gpxStr);
|
|
1122
|
+
```
|
|
1123
|
+
|
|
1124
|
+
And for KML files:
|
|
1125
|
+
```ts
|
|
1126
|
+
import { kml } from "@maptiler/sdk";
|
|
1127
|
+
|
|
1128
|
+
// ... assuming inside an async function
|
|
1129
|
+
|
|
1130
|
+
// Fetching the KML file as a string:
|
|
1131
|
+
const kmlFilePath = "some_gps_trace.kml";
|
|
1132
|
+
const kmlResponse = await fetch(kmlFilePath);
|
|
1133
|
+
const kmlStr = await res.text();
|
|
1134
|
+
|
|
1135
|
+
// Converting the KML payload into a GeoJSON FeatureCollection:
|
|
1136
|
+
const features = maptilersdk.gpx(kmlStr);
|
|
1137
|
+
```
|
|
1138
|
+
|
|
1139
|
+
|
|
1107
1140
|
## Take Screenshots, programmatically
|
|
1108
1141
|
There are two different ways to create screenshot, corresponding to two very different usecases. Note that screenshots will not contain *DOM elements* such as `Marker` and `Popup`, since those are not part of the rendering context.
|
|
1109
1142
|
|
package/vite.config-umd.ts
CHANGED
|
@@ -2,26 +2,20 @@ import { resolve } from 'path';
|
|
|
2
2
|
import { defineConfig } from 'vite';
|
|
3
3
|
|
|
4
4
|
const isProduction = process.env.NODE_ENV === "production";
|
|
5
|
-
const bundleFilename = isProduction ? "maptiler-sdk.umd.min.js" : "maptiler-sdk.umd.js"
|
|
6
|
-
|
|
7
|
-
const plugins = [];
|
|
8
|
-
|
|
9
5
|
|
|
10
6
|
export default defineConfig({
|
|
11
7
|
mode: isProduction ? "production" : "development",
|
|
12
8
|
build: {
|
|
13
9
|
outDir: "build",
|
|
14
|
-
minify:
|
|
10
|
+
minify: true,
|
|
15
11
|
emptyOutDir: isProduction,
|
|
16
12
|
sourcemap: true,
|
|
17
13
|
lib: {
|
|
18
|
-
// Could also be a dictionary or array of multiple entry points
|
|
19
14
|
entry: resolve(__dirname, 'src/index.ts'),
|
|
20
15
|
name: 'maptilersdk',
|
|
21
|
-
|
|
22
|
-
fileName: (format, entryName) => bundleFilename,
|
|
16
|
+
fileName: (format, entryName) => "maptiler-sdk.umd.min.js",
|
|
23
17
|
formats: ['umd'],
|
|
24
18
|
}
|
|
25
19
|
},
|
|
26
|
-
plugins,
|
|
27
|
-
})
|
|
20
|
+
plugins: [],
|
|
21
|
+
});
|