@maptiler/sdk 3.2.0-rc.1 → 3.3.0-rc2
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/.editorconfig +13 -0
- package/.husky/pre-commit +3 -1
- package/README.md +125 -0
- package/dist/maptiler-sdk.mjs +3476 -2827
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/src/MLAdapters/ScaleControl.d.ts +0 -3
- package/dist/src/Map.d.ts +19 -7
- package/dist/src/config.d.ts +1 -1
- package/dist/src/{MaptilerGeolocateControl.d.ts → controls/MaptilerGeolocateControl.d.ts} +1 -12
- package/dist/src/{MaptilerLogoControl.d.ts → controls/MaptilerLogoControl.d.ts} +2 -6
- package/dist/src/controls/MaptilerNavigationControl.d.ts +17 -0
- package/dist/src/{MaptilerProjectionControl.d.ts → controls/MaptilerProjectionControl.d.ts} +1 -11
- package/dist/src/{MaptilerTerrainControl.d.ts → controls/MaptilerTerrainControl.d.ts} +4 -13
- package/dist/src/{Minimap.d.ts → controls/Minimap.d.ts} +1 -1
- package/dist/src/controls/index.d.ts +6 -0
- package/dist/src/custom-layers/CubemapLayer/CubemapLayer.d.ts +29 -0
- package/dist/src/custom-layers/CubemapLayer/constants.d.ts +3 -0
- package/dist/src/custom-layers/CubemapLayer/index.d.ts +2 -0
- package/dist/src/custom-layers/CubemapLayer/loadCubemapTexture.d.ts +6 -0
- package/dist/src/custom-layers/CubemapLayer/types.d.ts +37 -0
- package/dist/src/custom-layers/RadialGradientLayer/RadialGradientLayer.d.ts +23 -0
- package/dist/src/custom-layers/RadialGradientLayer/index.d.ts +2 -0
- package/dist/src/custom-layers/RadialGradientLayer/types.d.ts +11 -0
- package/dist/src/custom-layers/extractCustomLayerStyle.d.ts +17 -0
- package/dist/src/custom-layers/index.d.ts +5 -0
- package/dist/src/helpers/stylehelper.d.ts +1 -1
- package/dist/src/helpers/vectorlayerhelpers.d.ts +1 -1
- package/dist/src/index.d.ts +8 -12
- package/dist/src/tools.d.ts +0 -2
- package/dist/src/utils/dom.d.ts +2 -0
- package/dist/src/utils/geo-utils.d.ts +6 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/math-utils.d.ts +4 -0
- package/dist/src/utils/webgl-utils.d.ts +49 -0
- package/dist/vite.config-test.d.ts +2 -0
- package/dist/vitest-setup-tests.d.ts +1 -0
- package/eslint.config.mjs +2 -1
- package/package.json +17 -6
- package/tsconfig.json +4 -1
- package/vite.config-dev.ts +4 -0
- package/vite.config-es.ts +4 -0
- package/vite.config-test.ts +7 -0
- package/vite.config-umd.ts +4 -0
- package/vitest-setup-tests.ts +4 -0
- package/dist/src/MaptilerNavigationControl.d.ts +0 -30
- package/dist/src/MaptilerScaleControl.d.ts +0 -15
- /package/dist/src/{colorramp.d.ts → ColorRamp.d.ts} +0 -0
- /package/dist/src/{defaults.d.ts → constants/defaults.d.ts} +0 -0
- /package/dist/src/{unit.d.ts → types.d.ts} +0 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# EditorConfig is awesome: https://EditorConfig.org
|
|
2
|
+
|
|
3
|
+
# top-most EditorConfig file
|
|
4
|
+
root = true
|
|
5
|
+
|
|
6
|
+
[*]
|
|
7
|
+
indent_style = space
|
|
8
|
+
indent_size = 2
|
|
9
|
+
end_of_line = LF
|
|
10
|
+
charset = utf-8
|
|
11
|
+
trim_trailing_whitespace = false
|
|
12
|
+
insert_final_newline = true
|
|
13
|
+
max_line_length = 180
|
package/.husky/pre-commit
CHANGED
package/README.md
CHANGED
|
@@ -230,6 +230,13 @@ Here is the full list:
|
|
|
230
230
|
- `MapStyle.TONER.BACKGROUND` (variant)
|
|
231
231
|
- `MapStyle.TONER.LITE` (variant)
|
|
232
232
|
- `MapStyle.TONER.LINES` (variant)
|
|
233
|
+
- `MapStyle.OCEAN` reference style with bathymetric highlights, does not have any variants.
|
|
234
|
+
- `MapStyle.LANDSCAPE` reference style terrain map for data overlays and visualisations
|
|
235
|
+
- `MapStyle.LANDSCAPE.DARK` (variant)
|
|
236
|
+
- `MapStyle.LANDSCAPE.VIVID` (variant)
|
|
237
|
+
- `MapStyle.AQUARELLE` reference style watercolor map for creative use
|
|
238
|
+
- `MapStyle.AQUARELLE.DARK` (variant)
|
|
239
|
+
- `MapStyle.AQUARELLE.VIVID` (variant)
|
|
233
240
|
- `MapStyle.OPENSTREETMAP` (reference style, this one does not have any variants)
|
|
234
241
|
|
|
235
242
|
|
|
@@ -533,7 +540,125 @@ map.on("terrainAnimationStop", (e) => {
|
|
|
533
540
|
});
|
|
534
541
|
});
|
|
535
542
|
```
|
|
543
|
+
# Halo and Space Options
|
|
536
544
|
|
|
545
|
+
The `halo` and `space` options allow for enhanced visual customization of the map, especially for globe projections.
|
|
546
|
+
|
|
547
|
+
## `halo` (Atmospheric Glow)
|
|
548
|
+
The `halo` option adds a gradient-based atmospheric glow around the globe, simulating the visual effect of Earth's atmosphere when viewed from space.
|
|
549
|
+
|
|
550
|
+
### Usage:
|
|
551
|
+
You can enable a simple halo by setting it to `true`:
|
|
552
|
+
```ts
|
|
553
|
+
const map = new maptilersdk.Map({
|
|
554
|
+
container: document.getElementById("map"),
|
|
555
|
+
style: maptilersdk.MapStyle.OUTDOOR,
|
|
556
|
+
halo: true,
|
|
557
|
+
});
|
|
558
|
+
```
|
|
559
|
+
For more customization, you can define a radial gradient with scale and stops:
|
|
560
|
+
```ts
|
|
561
|
+
|
|
562
|
+
const map = new maptilersdk.Map({
|
|
563
|
+
container: document.getElementById("map"),
|
|
564
|
+
style: maptilersdk.MapStyle.OUTDOOR,
|
|
565
|
+
halo: {
|
|
566
|
+
scale: 1.5, // Controls the halo size
|
|
567
|
+
stops: [
|
|
568
|
+
[0.2, "transparent"],
|
|
569
|
+
[0.2, "red"],
|
|
570
|
+
[0.4, "red"],
|
|
571
|
+
[0.4, "transparent"],
|
|
572
|
+
[0.6, "transparent"],
|
|
573
|
+
[0.6, "red"],
|
|
574
|
+
[0.8, "red"],
|
|
575
|
+
[0.8, "transparent"],
|
|
576
|
+
[1.0, "transparent"],
|
|
577
|
+
],
|
|
578
|
+
},
|
|
579
|
+
});
|
|
580
|
+
```
|
|
581
|
+
You can also set the halo dynamically after the map loads:
|
|
582
|
+
```ts
|
|
583
|
+
map.on("load", () => {
|
|
584
|
+
map.setHalo({
|
|
585
|
+
scale: 2,
|
|
586
|
+
stops: [
|
|
587
|
+
[0.0, "rgba(135,206,250,1)"],
|
|
588
|
+
[0.5, "rgba(0,0,250,0.75)"],
|
|
589
|
+
[0.75, "rgba(250,0,0,0.0)"],
|
|
590
|
+
],
|
|
591
|
+
});
|
|
592
|
+
});
|
|
593
|
+
```
|
|
594
|
+
## `space` (Background Environment)
|
|
595
|
+
|
|
596
|
+
The space option allows customizing the background environment of the globe, simulating deep space or skybox effects.
|
|
597
|
+
### Usage
|
|
598
|
+
|
|
599
|
+
You can enable a simple space background with a solid color:
|
|
600
|
+
```ts
|
|
601
|
+
const map = new maptilersdk.Map({
|
|
602
|
+
container: document.getElementById("map"),
|
|
603
|
+
style: maptilersdk.MapStyle.OUTDOOR,
|
|
604
|
+
space: {
|
|
605
|
+
color: "#111122", // Dark space-like color
|
|
606
|
+
},
|
|
607
|
+
});
|
|
608
|
+
```
|
|
609
|
+
Alternatively, you can provide a cubemap for a realistic skybox effect using one of the following methods:
|
|
610
|
+
|
|
611
|
+
Predefined Presets:
|
|
612
|
+
```ts
|
|
613
|
+
const map = new maptilersdk.Map({
|
|
614
|
+
container: document.getElementById("map"),
|
|
615
|
+
style: maptilersdk.MapStyle.OUTDOOR,
|
|
616
|
+
space: {
|
|
617
|
+
preset: "universe-dark",
|
|
618
|
+
},
|
|
619
|
+
});
|
|
620
|
+
```
|
|
621
|
+
Cubemap Images (Custom Skybox):
|
|
622
|
+
```ts
|
|
623
|
+
const map = new maptilersdk.Map({
|
|
624
|
+
container: document.getElementById("map"),
|
|
625
|
+
style: maptilersdk.MapStyle.OUTDOOR,
|
|
626
|
+
space: {
|
|
627
|
+
faces: {
|
|
628
|
+
pX: '/path-to-image/pX.png',
|
|
629
|
+
nX: '/path-to-image/nX.png',
|
|
630
|
+
pY: '/path-to-image/pY.png',
|
|
631
|
+
nY: '/path-to-image/nY.png',
|
|
632
|
+
pZ: '/path-to-image/pZ.png',
|
|
633
|
+
nZ: '/path-to-image/nZ.png',
|
|
634
|
+
},
|
|
635
|
+
},
|
|
636
|
+
});
|
|
637
|
+
```
|
|
638
|
+
Cubemap Path with image format, fetches all images from a path, this assumes all files are named px, nx, py, ny, pz, nz and suffixed with the appropriate extension specified in `format`.
|
|
639
|
+
```ts
|
|
640
|
+
const map = new maptilersdk.Map({
|
|
641
|
+
container: document.getElementById("map"),
|
|
642
|
+
style: maptilersdk.MapStyle.OUTDOOR,
|
|
643
|
+
space: {
|
|
644
|
+
path: {
|
|
645
|
+
baseUrl: "spacebox/transparent",
|
|
646
|
+
format: "png", // Defaults to PNG
|
|
647
|
+
},
|
|
648
|
+
},
|
|
649
|
+
});
|
|
650
|
+
```
|
|
651
|
+
You can also set the space background dynamically:
|
|
652
|
+
```ts
|
|
653
|
+
map.on("load", () => {
|
|
654
|
+
map.setSpace({
|
|
655
|
+
color: "red",
|
|
656
|
+
path: {
|
|
657
|
+
baseUrl: "spacebox/transparent",
|
|
658
|
+
},
|
|
659
|
+
});
|
|
660
|
+
});
|
|
661
|
+
```
|
|
537
662
|
|
|
538
663
|
# Easy language switching
|
|
539
664
|
The language generally depends on the style but we made it possible to easily set and update from a built-in list of languages.
|