@maptiler/sdk 2.5.0 → 2.5.1

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.
@@ -18,4 +18,5 @@ export declare class MaptilerGeolocateControl extends GeolocateControl {
18
18
  _finishSetupUI: (supported: boolean) => void;
19
19
  _updateCircleRadius(): void;
20
20
  _onZoom: () => void;
21
+ _setErrorState(): void;
21
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maptiler/sdk",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
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",
package/readme.md CHANGED
@@ -987,7 +987,40 @@ Turning off *zoom compensation* allows for more accurate adjustments to the visu
987
987
 
988
988
  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).
989
989
 
990
- # Other helper
990
+ # Other helpers
991
+ ## Convert GPX and KML to GeoJSON
992
+ 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:
993
+
994
+ ```ts
995
+ import { gpx } from "@maptiler/sdk";
996
+
997
+ // ... assuming inside an async function
998
+
999
+ // Fetching the GPX file as a string:
1000
+ const gpxFilePath = "some_gps_trace.gpx";
1001
+ const gpxResponse = await fetch(gpxFilePath);
1002
+ const gpxStr = await res.text();
1003
+
1004
+ // Converting the GPX payload into a GeoJSON FeatureCollection:
1005
+ const features = maptilersdk.gpx(gpxStr);
1006
+ ```
1007
+
1008
+ And for KML files:
1009
+ ```ts
1010
+ import { kml } from "@maptiler/sdk";
1011
+
1012
+ // ... assuming inside an async function
1013
+
1014
+ // Fetching the KML file as a string:
1015
+ const kmlFilePath = "some_gps_trace.kml";
1016
+ const kmlResponse = await fetch(kmlFilePath);
1017
+ const kmlStr = await res.text();
1018
+
1019
+ // Converting the KML payload into a GeoJSON FeatureCollection:
1020
+ const features = maptilersdk.gpx(kmlStr);
1021
+ ```
1022
+
1023
+
991
1024
  ## Take Screenshots, programmatically
992
1025
  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.
993
1026