@maptiler/sdk 1.2.0 → 1.2.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.
- package/CHANGELOG.md +11 -0
- package/dist/maptiler-sdk.d.ts +21 -3
- package/dist/maptiler-sdk.min.mjs +2 -2
- package/dist/maptiler-sdk.mjs +27 -4
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/maptiler-sdk.umd.js +744 -39
- package/dist/maptiler-sdk.umd.js.map +1 -1
- package/dist/maptiler-sdk.umd.min.js +42 -42
- package/package.json +3 -3
- package/readme.md +195 -5
- package/src/Map.ts +27 -3
- package/src/index.ts +88 -129
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maptiler/sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.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",
|
|
@@ -74,10 +74,10 @@
|
|
|
74
74
|
"xmldom": "^0.6.0"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@maptiler/client": "^1.
|
|
77
|
+
"@maptiler/client": "^1.8.0",
|
|
78
78
|
"events": "^3.3.0",
|
|
79
79
|
"js-base64": "^3.7.4",
|
|
80
|
-
"maplibre-gl": "3.
|
|
80
|
+
"maplibre-gl": "3.6.2",
|
|
81
81
|
"uuid": "^9.0.0"
|
|
82
82
|
}
|
|
83
83
|
}
|
package/readme.md
CHANGED
|
@@ -392,16 +392,32 @@ Languages that are written right-to-left such as arabic and hebrew are fully sup
|
|
|
392
392
|
|
|
393
393
|
# Custom Events and Map Lifecycle
|
|
394
394
|
## Events
|
|
395
|
-
|
|
395
|
+
### The `ready` event
|
|
396
|
+
The `ready` event happens just after the `load` event but waits that all the controls managed by the `Map` constructor are dealt with, some having an asynchronous logic to set up.
|
|
397
|
+
Since the `ready` event waits that all the basic controls are nicely positioned, it is **safer** to use `ready` than `load` if you plan to add other custom comtrols with the `.addControl()` method.
|
|
396
398
|
|
|
397
|
-
|
|
399
|
+
This event works exactely the same way as `load` and you can safely replace those by `"ready"`. Here is a usage example:
|
|
400
|
+
|
|
401
|
+
```js
|
|
402
|
+
const map = new maptilersdk.Map({
|
|
403
|
+
container: "map-container",
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
map.on("ready", (evt) => {
|
|
407
|
+
const terrainControl = new maptilersdk.MaptilerTerrainControl();
|
|
408
|
+
map.addControl(terrainControl);
|
|
409
|
+
})
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### The `loadWithTerrain` event
|
|
413
|
+
The `loadWithTerrain` event is triggered only *once* in a `Map` instance lifecycle, when both the `ready` event and the `terrain` event **with non-null terrain** are fired.
|
|
398
414
|
|
|
399
415
|
**Why a new event?**
|
|
400
416
|
When a map is instanciated with the option `terrain: true`, then MapTiler terrain is directly added to it and some animation functions such as `.flyTo()` or `.easeTo()` if started straight after the map initialization will actually need to wait a few milliseconds that the terrain is properly initialized before running.
|
|
401
|
-
Relying on the `load` event to run an animation with a map with terrain may fail in some cases for this reason, and this is why waiting for `loadWithTerrain` is safer in this particular situation.
|
|
417
|
+
Relying on the `ready` or `load` event to run an animation with a map with terrain may fail in some cases for this reason, and this is why waiting for `loadWithTerrain` is safer in this particular situation.
|
|
402
418
|
|
|
403
419
|
## Lifecycle Methods
|
|
404
|
-
The events `load` and `loadWithTerrain` are both called *at most once* and require a callback function to add more elements such as markers, layers, popups and data sources. Even though MapTiler SDK fully supports this logic, we have also included a *promise* logic to provide a more linear and less nested way to wait for a Map instance to be
|
|
420
|
+
The events `load`, `ready` and `loadWithTerrain` are both called *at most once* and require a callback function to add more elements such as markers, layers, popups and data sources. Even though MapTiler SDK fully supports this logic, we have also included a *promise* logic to provide a more linear and less nested way to wait for a Map instance to be usable. Let's compare the two ways:
|
|
405
421
|
|
|
406
422
|
- Classic: with a callback on the `load` event:
|
|
407
423
|
```ts
|
|
@@ -494,9 +510,54 @@ async function init() {
|
|
|
494
510
|
}
|
|
495
511
|
```
|
|
496
512
|
|
|
513
|
+
And finally, the lifecycle method corresponding to the `ready` event:
|
|
514
|
+
- Classic: with a callback on the `ready` event:
|
|
515
|
+
```ts
|
|
516
|
+
function init() {
|
|
517
|
+
|
|
518
|
+
const map = new Map({
|
|
519
|
+
container,
|
|
520
|
+
center: [2.34804, 48.85439], // Paris, France
|
|
521
|
+
zoom: 14,
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
// We wait for the event.
|
|
525
|
+
// Once triggered, the callback is ranin it's own scope.
|
|
526
|
+
map.on("ready", (evt) => {
|
|
527
|
+
// Adding a data source
|
|
528
|
+
map.addSource('my-gps-track-source', {
|
|
529
|
+
type: "geojson",
|
|
530
|
+
data: "https://example.com/some-gps-track.geojson",
|
|
531
|
+
});
|
|
532
|
+
})
|
|
533
|
+
}
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
- Modern: with a promise returned by the method `.onReadyAsync()`, used in an `async` function:
|
|
537
|
+
```ts
|
|
538
|
+
async function init() {
|
|
539
|
+
|
|
540
|
+
const map = new Map({
|
|
541
|
+
container,
|
|
542
|
+
center: [2.34804, 48.85439], // Paris, France
|
|
543
|
+
zoom: 14,
|
|
544
|
+
});
|
|
545
|
+
|
|
546
|
+
// We wait for the promise to resolve.
|
|
547
|
+
// Once triggered, the rest of the init function runs
|
|
548
|
+
await map.onReadyAsync();
|
|
549
|
+
|
|
550
|
+
// Adding a data source
|
|
551
|
+
map.addSource('my-gps-track-source', {
|
|
552
|
+
type: "geojson",
|
|
553
|
+
data: "https://example.com/some-gps-track.geojson",
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
```
|
|
557
|
+
|
|
497
558
|
We believe that the *promise* approach is better because it does not nest scopes and will allow for a linear non-nested stream of execution. It also corresponds to more modern development standards.
|
|
498
559
|
|
|
499
|
-
> 📣 *__Note:__* Generally speaking, *promises* are not a go to replacement for all event+callback and are suitable only for events that are called only once in the lifecycle of a Map instance. This is the reason why we have decided to provide a *promise* equivalent only for the `load` and `loadWithTerrain` events.
|
|
560
|
+
> 📣 *__Note:__* Generally speaking, *promises* are not a go to replacement for all event+callback and are suitable only for events that are called only once in the lifecycle of a Map instance. This is the reason why we have decided to provide a *promise* equivalent only for the `load`, `ready` and `loadWithTerrain` events but not for events that may be called multiple time such as interaction events.
|
|
500
561
|
|
|
501
562
|
# Color Ramps
|
|
502
563
|
A color ramp is a color gradient defined in a specific interval, for instance in [0, 1], and for any value within this interval will retrieve a color. They are defined by at least a color at each bound and usualy additional colors within the range.
|
|
@@ -1061,3 +1122,132 @@ And voila!
|
|
|
1061
1122
|
> 📣 *__Note:__* The GeoJSON for this track contains 9380 couples of coordinates, which is a lot! In order to send the track to MapTiler Cloud static maps API, the client simplifies the long paths while keeping a high degree of precision using a very fast [Ramer-Douglas-Peucker algorithm](https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm).
|
|
1062
1123
|
|
|
1063
1124
|
Read more about bounded static maps on our official [API documentation](https://docs.maptiler.com/cloud/api/static-maps/#auto-fitted-image).
|
|
1125
|
+
|
|
1126
|
+
## 🏔️ Elevation
|
|
1127
|
+
With the elevation API, it's possible to get the elevation in metter from any location. It's possible to lookup and compute elevation for a single location, to provide a batch of points, from a GeoJSON LineString or from a GeoJSON MultiLineString!
|
|
1128
|
+
|
|
1129
|
+
> ℹ️ Under the hood, the elevation API is fueled by MapTiler Cloud's **RGB Terrain** raster tileset, which is a composite of many high-resolution DEMs from all over the world, currated and processed by our geodata team! The same dataset is also fueling our SDK's elevation (3D terrain) and the hillshading we use in many of our styles.
|
|
1130
|
+
|
|
1131
|
+
> 📣 Note for **TypeScript** users: internaly, the elevation feature relies on some *GeoJSON* types definitions that can be found in this NPM package: `@types/geojson`. Namely `LineString`, `MultiLineString` and `Position`. It may improve your developer experience to also use these types.
|
|
1132
|
+
|
|
1133
|
+
Let's see how to use it:
|
|
1134
|
+
|
|
1135
|
+
### At a single location
|
|
1136
|
+
```ts
|
|
1137
|
+
// Not mandatory, but it's to explain where the type comes from:
|
|
1138
|
+
import { Position } from "geojson";
|
|
1139
|
+
|
|
1140
|
+
const montBlancPeak: Position = [6.864884, 45.832743];
|
|
1141
|
+
const elevatedPosition = await maptilersdk.elevation.at(montBlancPeak);
|
|
1142
|
+
```
|
|
1143
|
+
The returned value is also a *GeoJSON* `Position` array, but with three elements: `[lng, lat, elevation]`.
|
|
1144
|
+
|
|
1145
|
+
Read more about elevation lookup for a single location in our [official documentation](https://docs.maptiler.com/client-js/elevation/#at).
|
|
1146
|
+
|
|
1147
|
+
### Batch mode
|
|
1148
|
+
```ts
|
|
1149
|
+
// Not mandatory, but it's to explain where the type comes from:
|
|
1150
|
+
import { Position } from "geojson";
|
|
1151
|
+
|
|
1152
|
+
const peaks: Position[] = [
|
|
1153
|
+
[6.864884, 45.832743], // Mont Blanc, Alps
|
|
1154
|
+
[86.9250, 27.9881], // Mount Everest, Himalayas
|
|
1155
|
+
[-70.0109, -32.6532], // Aconcagua, Andes
|
|
1156
|
+
[-151.0064, 63.0695], // Denali, Alaska
|
|
1157
|
+
[37.3556, -3.0674], // Mount Kilimanjaro
|
|
1158
|
+
[42.4453, 43.3499], // Mount Elbrus, Caucasus
|
|
1159
|
+
[137.1595, -4.0784], // Puncak Jaya, Sudirman Range
|
|
1160
|
+
[-140.4055, 60.5672], // Mount Logan, Saint Elias Mountains
|
|
1161
|
+
[138.73111, 35.358055], // Mount Fuji
|
|
1162
|
+
];
|
|
1163
|
+
|
|
1164
|
+
const elevatedPeaks = await maptilersdk.elevation.batch(peaks);
|
|
1165
|
+
```
|
|
1166
|
+
|
|
1167
|
+
Read more about elevation lookup for a batch of locations in our [official documentation](https://docs.maptiler.com/client-js/elevation/#batch).
|
|
1168
|
+
|
|
1169
|
+
### From a GeoJSON LineString
|
|
1170
|
+
In the *GeoJSON* LineString case, it clones the entire structure and the positions arrays of the clone will contain three element: `[lng, lat, elevation]`. The original LineString is not mutated nor pointed at.
|
|
1171
|
+
|
|
1172
|
+
```ts
|
|
1173
|
+
// Not mandatory, but it's to explain where the type comes from:
|
|
1174
|
+
import { LineString } from "geojson";
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
const someLineString: LineString = {
|
|
1178
|
+
type: "LineString",
|
|
1179
|
+
coordinates: [[6.864884, 45.832743], [86.9250, 27.9881], [-70.0109, -32.6532]]
|
|
1180
|
+
};
|
|
1181
|
+
|
|
1182
|
+
const someElevatedLineString = await maptilersdk.elevation.fromLineString(someLineString);
|
|
1183
|
+
// someElevatedLineString is also of type LineString
|
|
1184
|
+
```
|
|
1185
|
+
|
|
1186
|
+
Read more about elevation lookup for a `LineString` in our [official documentation](https://docs.maptiler.com/client-js/elevation/#linestring).
|
|
1187
|
+
|
|
1188
|
+
### From a GeoJSON MultiLineString
|
|
1189
|
+
In the *GeoJSON* MultiLineString case, it clones the entire structure and the positions arrays of the clone will contain three element: `[lng, lat, elevation]`. The original MultiLineString is not mutated nor pointed at.
|
|
1190
|
+
|
|
1191
|
+
```ts
|
|
1192
|
+
// Not mandatory, but it's to explain where the type comes from:
|
|
1193
|
+
import { MultiLineString } from "geojson";
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
const someMultiLineString: MultiLineString = {
|
|
1197
|
+
type: "LineString",
|
|
1198
|
+
coordinates: [
|
|
1199
|
+
[[6.864884, 45.832743], [86.9250, 27.9881], [-70.0109, -32.6532]],
|
|
1200
|
+
[[-151.0064, 63.0695], [37.3556, -3.0674], [42.4453, 43.3499]],
|
|
1201
|
+
[[137.1595, -4.0784], [-140.4055, 60.5672], [138.73111, 35.358055]],
|
|
1202
|
+
]
|
|
1203
|
+
};
|
|
1204
|
+
|
|
1205
|
+
const someElevatedMultiLineString = await maptilersdk.elevation.fromMultiLineString(someMultiLineString);
|
|
1206
|
+
// someElevatedMultiLineString is also of type MultiLineString
|
|
1207
|
+
```
|
|
1208
|
+
|
|
1209
|
+
Read more about elevation lookup for a `MultiLineString` in our [official documentation](https://docs.maptiler.com/client-js/elevation/#multilinestring).
|
|
1210
|
+
|
|
1211
|
+
### Caching
|
|
1212
|
+
In order to increase performance while reducing unnecessary elevation data fetching, the elevation tiles are cached. This is particularly important for the LineString and MultiLineString lookups because GeoJSON data are likely to come from a recorded or planned route, where position points are very close to one another.
|
|
1213
|
+
|
|
1214
|
+
## 🧮 Math
|
|
1215
|
+
Some operations can be fairly repetitive: WGS84 to Mercator, WGS84 to *zxy* tile index, distance between two points with Haversine formula, etc. As a result, we have decided to expose a `math` package providing the most recurent feature, so that, just like us at MapTiler, you no longer need to copy-paste the same function from your previous project!
|
|
1216
|
+
|
|
1217
|
+
The `math` package differs from the others in the sense that it does not call the MapTiler Cloud API, instead it operates fully on the machine it's running on.
|
|
1218
|
+
|
|
1219
|
+
Here are some examples:
|
|
1220
|
+
|
|
1221
|
+
```ts
|
|
1222
|
+
// Not mandatory, but it's to explain where the type comes from:
|
|
1223
|
+
import { Position } from "geojson";
|
|
1224
|
+
|
|
1225
|
+
// Some constants
|
|
1226
|
+
const earthRadius = maptilersdk.math.EARTH_RADIUS;
|
|
1227
|
+
const earthCircumference = maptilersdk.math.EARTH_CIRCUMFERENCE;
|
|
1228
|
+
|
|
1229
|
+
const montBlancPeakWgs84: Position = [6.864884, 45.832743];
|
|
1230
|
+
|
|
1231
|
+
// From WGS84 to Mercator
|
|
1232
|
+
const montBlancPeakMerc = maptilersdk.math.wgs84ToMercator(montBlancPeakWgs84); // also of type Position
|
|
1233
|
+
|
|
1234
|
+
// From Mercator to WGS84
|
|
1235
|
+
const montBlancPeakWgs84Again = maptilersdk.math.mercatorToWgs84(montBlancPeakMerc);
|
|
1236
|
+
|
|
1237
|
+
// A great-circle distance in meter:
|
|
1238
|
+
const from: Position = /* ... */;
|
|
1239
|
+
const to: Position = /* ... */;
|
|
1240
|
+
const distance = maptilersdk.math.haversineDistanceWgs84(from, to);
|
|
1241
|
+
|
|
1242
|
+
// Full distance of a route made of many positions
|
|
1243
|
+
const route: Position[] = /* ... */;
|
|
1244
|
+
const totalDistance = maptilersdk.math.haversineCumulatedDistanceWgs84(route);
|
|
1245
|
+
|
|
1246
|
+
// Lon lat to tile index, given a zoom level. An [x, y] array is returned
|
|
1247
|
+
const tileXY = maptilersdk.math.wgs84ToTileIndex(montBlancPeakWgs84, 14);
|
|
1248
|
+
// Possible to have floating point tile indices with a third argument to `false`
|
|
1249
|
+
|
|
1250
|
+
// and many more!
|
|
1251
|
+
```
|
|
1252
|
+
|
|
1253
|
+
Please find out more about the math package in our [official documentation](https://docs.maptiler.com/client-js/math):
|
package/src/Map.ts
CHANGED
|
@@ -182,6 +182,7 @@ export class Map extends maplibregl.Map {
|
|
|
182
182
|
private minimap?: Minimap;
|
|
183
183
|
private forceLanguageUpdate: boolean;
|
|
184
184
|
private languageAlwaysBeenStyle: boolean;
|
|
185
|
+
private isReady: boolean = false;
|
|
185
186
|
|
|
186
187
|
constructor(options: MapOptions) {
|
|
187
188
|
if (options.apiKey) {
|
|
@@ -459,11 +460,14 @@ export class Map extends maplibregl.Map {
|
|
|
459
460
|
|
|
460
461
|
this.addControl(new FullscreenControl({}), position);
|
|
461
462
|
}
|
|
463
|
+
|
|
464
|
+
this.isReady = true;
|
|
465
|
+
this.fire("ready", { target: this });
|
|
462
466
|
});
|
|
463
467
|
|
|
464
468
|
// Creating a custom event: "loadWithTerrain"
|
|
465
469
|
// that fires only once when both:
|
|
466
|
-
// - the map has full
|
|
470
|
+
// - the map has full ready (corresponds to the the "ready" event)
|
|
467
471
|
// - the terrain has loaded (corresponds to the "terrain" event with terrain beion non-null)
|
|
468
472
|
// This custom event is necessary to wait for when the map is instanciated with `terrain: true`
|
|
469
473
|
// and some animation (flyTo, easeTo) are running from the begining.
|
|
@@ -471,7 +475,7 @@ export class Map extends maplibregl.Map {
|
|
|
471
475
|
let terrainEventTriggered = false;
|
|
472
476
|
let terrainEventData: LoadWithTerrainEvent;
|
|
473
477
|
|
|
474
|
-
this.once("
|
|
478
|
+
this.once("ready", () => {
|
|
475
479
|
loadEventTriggered = true;
|
|
476
480
|
if (terrainEventTriggered) {
|
|
477
481
|
this.fire("loadWithTerrain", terrainEventData);
|
|
@@ -581,6 +585,26 @@ export class Map extends maplibregl.Map {
|
|
|
581
585
|
});
|
|
582
586
|
}
|
|
583
587
|
|
|
588
|
+
/**
|
|
589
|
+
* Awaits for _this_ Map instance to be "ready" and returns a Promise to the Map.
|
|
590
|
+
* If _this_ Map instance is already ready, the Promise is resolved directly,
|
|
591
|
+
* otherwise, it is resolved as a result of the "ready" event.
|
|
592
|
+
* A map instance is "ready" when all the controls that can be managed by the contructor are
|
|
593
|
+
* dealt with. This happens after the "load" event, due to the asynchronous nature
|
|
594
|
+
* of some built-in controls.
|
|
595
|
+
*/
|
|
596
|
+
async onReadyAsync() {
|
|
597
|
+
return new Promise<Map>((resolve) => {
|
|
598
|
+
if (this.isReady) {
|
|
599
|
+
return resolve(this);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
this.once("ready", () => {
|
|
603
|
+
resolve(this);
|
|
604
|
+
});
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
|
|
584
608
|
/**
|
|
585
609
|
* Awaits for _this_ Map instance to be "loaded" as well as with terrain being non-null for the first time
|
|
586
610
|
* and returns a Promise to the Map.
|
|
@@ -590,7 +614,7 @@ export class Map extends maplibregl.Map {
|
|
|
590
614
|
*/
|
|
591
615
|
async onLoadWithTerrainAsync() {
|
|
592
616
|
return new Promise<Map>((resolve) => {
|
|
593
|
-
if (this.
|
|
617
|
+
if (this.isReady && this.terrain) {
|
|
594
618
|
return resolve(this);
|
|
595
619
|
}
|
|
596
620
|
|
package/src/index.ts
CHANGED
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
* Maplibre export first, then extensions can overload the exports.
|
|
3
3
|
*/
|
|
4
4
|
export * from "maplibre-gl";
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* To perform explicit named export so that they are included in the UMD bundle
|
|
8
7
|
*/
|
|
9
8
|
// import * as ML from "maplibre-gl";
|
|
10
|
-
|
|
11
9
|
import maplibregl from "maplibre-gl";
|
|
12
|
-
|
|
13
10
|
const {
|
|
14
11
|
// supported,
|
|
15
12
|
setRTLTextPlugin,
|
|
@@ -28,7 +25,6 @@ const {
|
|
|
28
25
|
addProtocol,
|
|
29
26
|
removeProtocol,
|
|
30
27
|
} = maplibregl;
|
|
31
|
-
|
|
32
28
|
// We still want to export maplibregl.Map, but as a different name
|
|
33
29
|
const MapMLGL = maplibregl.Map;
|
|
34
30
|
const MarkerMLGL = maplibregl.Marker;
|
|
@@ -48,7 +44,6 @@ const LogoControlMLGL = maplibregl.LogoControl;
|
|
|
48
44
|
const ScaleControlMLGL = maplibregl.ScaleControl;
|
|
49
45
|
const FullscreenControlMLGL = maplibregl.FullscreenControl;
|
|
50
46
|
const TerrainControlMLGL = maplibregl.TerrainControl;
|
|
51
|
-
|
|
52
47
|
export {
|
|
53
48
|
// supported,
|
|
54
49
|
setRTLTextPlugin,
|
|
@@ -78,7 +73,6 @@ export {
|
|
|
78
73
|
removeProtocol,
|
|
79
74
|
MapMLGL,
|
|
80
75
|
};
|
|
81
|
-
|
|
82
76
|
// Exporting types of class instances from MapLibre:
|
|
83
77
|
export type NavigationControlMLGL = InstanceType<typeof NavigationControlMLGL>;
|
|
84
78
|
export type GeolocateControlMLGL = InstanceType<typeof GeolocateControlMLGL>;
|
|
@@ -107,136 +101,101 @@ export type RasterTileSourceMLGL = InstanceType<typeof RasterTileSourceMLGL>;
|
|
|
107
101
|
export type VectorTileSourceMLGL = InstanceType<typeof VectorTileSourceMLGL>;
|
|
108
102
|
export type VideoSourceMLGL = InstanceType<typeof VideoSourceMLGL>;
|
|
109
103
|
export type MapMLGL = InstanceType<typeof MapMLGL>;
|
|
110
|
-
|
|
111
104
|
// SDK specific
|
|
112
|
-
import { Map, GeolocationType } from "./Map";
|
|
113
|
-
import type { MapOptions, LoadWithTerrainEvent } from "./Map";
|
|
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
|
|
134
|
-
import { MaptilerGeolocateControl } from "./MaptilerGeolocateControl";
|
|
135
|
-
import { MaptilerLogoControl } from "./MaptilerLogoControl";
|
|
136
|
-
import { MaptilerTerrainControl } from "./MaptilerTerrainControl";
|
|
137
|
-
import { MaptilerNavigationControl } from "./MaptilerNavigationControl";
|
|
138
|
-
|
|
139
|
-
// importing client functions to expose them as part of the SDK
|
|
140
|
-
import type {
|
|
141
|
-
BBox,
|
|
142
|
-
Position,
|
|
143
|
-
GeocodingOptions,
|
|
144
|
-
CoordinatesSearchOptions,
|
|
145
|
-
CenteredStaticMapOptions,
|
|
146
|
-
AutomaticStaticMapOptions,
|
|
147
|
-
BoundedStaticMapOptions,
|
|
148
|
-
} from "@maptiler/client";
|
|
149
|
-
|
|
150
|
-
import {
|
|
151
|
-
geocoding,
|
|
152
|
-
geolocation,
|
|
153
|
-
coordinates,
|
|
154
|
-
data,
|
|
155
|
-
staticMaps,
|
|
156
|
-
ServiceError,
|
|
157
|
-
LanguageGeocoding,
|
|
158
|
-
LanguageGeocodingString,
|
|
159
|
-
ReferenceMapStyle,
|
|
160
|
-
MapStyle,
|
|
161
|
-
MapStyleVariant,
|
|
162
|
-
} from "@maptiler/client";
|
|
163
|
-
|
|
164
|
-
import type { MapStyleType } from "@maptiler/client";
|
|
165
|
-
|
|
166
|
-
import { Point } from "./Point";
|
|
167
|
-
import type { Matrix2 } from "./Point";
|
|
168
|
-
|
|
169
|
-
// Importing enums and configs
|
|
170
|
-
import { config, SdkConfig } from "./config";
|
|
171
|
-
import { Language, LanguageString, LanguageKey } from "./language";
|
|
172
|
-
import type { Unit } from "./unit";
|
|
173
|
-
import type { MinimapOptionsInput } from "./Minimap";
|
|
174
|
-
|
|
175
|
-
// Exporting types
|
|
176
|
-
export type {
|
|
177
|
-
MapOptions,
|
|
178
|
-
MinimapOptionsInput,
|
|
179
|
-
LoadWithTerrainEvent,
|
|
180
|
-
GeocodingOptions,
|
|
181
|
-
BBox,
|
|
182
|
-
Position,
|
|
183
|
-
CoordinatesSearchOptions,
|
|
184
|
-
CenteredStaticMapOptions,
|
|
185
|
-
BoundedStaticMapOptions,
|
|
186
|
-
AutomaticStaticMapOptions,
|
|
187
|
-
LanguageString,
|
|
188
|
-
LanguageKey,
|
|
189
|
-
LanguageGeocodingString,
|
|
190
|
-
Unit,
|
|
191
|
-
MapStyleType,
|
|
192
|
-
Matrix2,
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
// Export convert functions 'str2xml', 'xml2str', 'gpx', and 'kml'
|
|
196
|
-
export * from "./converters";
|
|
197
|
-
|
|
198
|
-
// Export the color ramp logic and all the built-in color ramps
|
|
199
|
-
export * from "./colorramp";
|
|
200
|
-
|
|
201
|
-
// Exporting classes, objects, functions, etc.
|
|
202
105
|
export {
|
|
203
106
|
Map,
|
|
204
|
-
Marker,
|
|
205
|
-
Popup,
|
|
206
|
-
Style,
|
|
207
|
-
CanvasSource,
|
|
208
|
-
GeoJSONSource,
|
|
209
|
-
ImageSource,
|
|
210
|
-
RasterTileSource,
|
|
211
|
-
RasterDEMTileSource,
|
|
212
|
-
VideoSource,
|
|
213
|
-
NavigationControl,
|
|
214
|
-
GeolocateControl,
|
|
215
|
-
AttributionControl,
|
|
216
|
-
LogoControl,
|
|
217
|
-
ScaleControl,
|
|
218
|
-
FullscreenControl,
|
|
219
|
-
TerrainControl,
|
|
220
|
-
VectorTileSource,
|
|
221
107
|
GeolocationType,
|
|
222
|
-
|
|
223
|
-
|
|
108
|
+
type MapOptions,
|
|
109
|
+
type LoadWithTerrainEvent,
|
|
110
|
+
} from "./Map";
|
|
111
|
+
export { Marker } from "./Marker";
|
|
112
|
+
export { Popup } from "./Popup";
|
|
113
|
+
export { Style } from "./Style";
|
|
114
|
+
export { CanvasSource } from "./CanvasSource";
|
|
115
|
+
export { GeoJSONSource } from "./GeoJSONSource";
|
|
116
|
+
export { ImageSource } from "./ImageSource";
|
|
117
|
+
export { RasterTileSource } from "./RasterTileSource";
|
|
118
|
+
export { RasterDEMTileSource } from "./RasterDEMTileSource";
|
|
119
|
+
export { VectorTileSource } from "./VectorTileSource";
|
|
120
|
+
export { VideoSource } from "./VideoSource";
|
|
121
|
+
export { NavigationControl } from "./NavigationControl";
|
|
122
|
+
export { GeolocateControl } from "./GeolocateControl";
|
|
123
|
+
export { AttributionControl } from "./AttributionControl";
|
|
124
|
+
export { LogoControl } from "./LogoControl";
|
|
125
|
+
export { ScaleControl } from "./ScaleControl";
|
|
126
|
+
export { FullscreenControl } from "./FullscreenControl";
|
|
127
|
+
export { TerrainControl } from "./TerrainControl";
|
|
128
|
+
// Export of modified versions of the controls
|
|
129
|
+
export * from "./MaptilerGeolocateControl";
|
|
130
|
+
export * from "./MaptilerLogoControl";
|
|
131
|
+
export * from "./MaptilerTerrainControl";
|
|
132
|
+
export * from "./MaptilerNavigationControl";
|
|
133
|
+
export {
|
|
134
|
+
type AutomaticStaticMapOptions,
|
|
135
|
+
type BoundedStaticMapOptions,
|
|
136
|
+
type BufferToPixelDataFunction,
|
|
137
|
+
type ByIdGeocodingOptions,
|
|
138
|
+
type CenteredStaticMapOptions,
|
|
139
|
+
type CommonForwardAndReverseGeocodingOptions,
|
|
140
|
+
type CoordinateExport,
|
|
141
|
+
type CoordinateGrid,
|
|
142
|
+
type CoordinateId,
|
|
143
|
+
type CoordinateSearch,
|
|
144
|
+
type CoordinateSearchResult,
|
|
145
|
+
type CoordinateTransformResult,
|
|
146
|
+
type CoordinateTransformation,
|
|
147
|
+
type Coordinates,
|
|
148
|
+
type CoordinatesSearchOptions,
|
|
149
|
+
type CoordinatesTransformOptions,
|
|
150
|
+
type DefaultTransformation,
|
|
151
|
+
type ElevationAtOptions,
|
|
152
|
+
type ElevationBatchOptions,
|
|
153
|
+
type FeatureHierarchy,
|
|
154
|
+
type FetchFunction,
|
|
155
|
+
type GeocodingFeature,
|
|
156
|
+
type GeocodingOptions,
|
|
157
|
+
type GeocodingSearchResult,
|
|
158
|
+
type GeolocationInfoOptions,
|
|
159
|
+
type GeolocationResult,
|
|
160
|
+
type GetDataOptions,
|
|
161
|
+
LanguageGeocoding,
|
|
162
|
+
type LanguageGeocodingOptions,
|
|
163
|
+
type LanguageGeocodingString,
|
|
164
|
+
MapStyle,
|
|
165
|
+
type MapStylePreset,
|
|
166
|
+
type MapStyleType,
|
|
167
|
+
MapStyleVariant,
|
|
168
|
+
type PixelData,
|
|
169
|
+
ReferenceMapStyle,
|
|
170
|
+
type ReverseGeocodingOptions,
|
|
224
171
|
ServiceError,
|
|
225
|
-
|
|
226
|
-
|
|
172
|
+
type StaticMapBaseOptions,
|
|
173
|
+
type StaticMapMarker,
|
|
174
|
+
type TileJSON,
|
|
175
|
+
type XYZ,
|
|
176
|
+
bufferToPixelDataBrowser,
|
|
177
|
+
circumferenceAtLatitude,
|
|
227
178
|
coordinates,
|
|
228
179
|
data,
|
|
180
|
+
elevation,
|
|
181
|
+
expandMapStyle,
|
|
182
|
+
geocoding,
|
|
183
|
+
geolocation,
|
|
184
|
+
getAutoLanguageGeocoding,
|
|
185
|
+
getBufferToPixelDataParser,
|
|
186
|
+
getTileCache,
|
|
187
|
+
mapStylePresetList,
|
|
188
|
+
math,
|
|
189
|
+
misc,
|
|
229
190
|
staticMaps,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
LanguageGeocoding,
|
|
233
|
-
Point,
|
|
234
|
-
ReferenceMapStyle,
|
|
235
|
-
MapStyleVariant,
|
|
236
|
-
MaptilerGeolocateControl,
|
|
237
|
-
MaptilerLogoControl,
|
|
238
|
-
MaptilerTerrainControl,
|
|
239
|
-
MaptilerNavigationControl,
|
|
240
|
-
};
|
|
191
|
+
styleToStyle,
|
|
192
|
+
} from "@maptiler/client";
|
|
241
193
|
|
|
194
|
+
export * from "./Point";
|
|
195
|
+
export { config, SdkConfig } from "./config";
|
|
196
|
+
export * from "./language";
|
|
197
|
+
export { type Unit } from "./unit";
|
|
198
|
+
export * from "./Minimap";
|
|
199
|
+
export * from "./converters";
|
|
200
|
+
export * from "./colorramp";
|
|
242
201
|
export * from "./helpers";
|