@maptiler/sdk 1.0.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/.eslintignore +1 -0
- package/.eslintrc.cjs +10 -0
- package/.github/workflows/npm-publish.yml +23 -0
- package/LICENSE +29 -0
- package/demos/maptiler-sdk.css +147 -0
- package/demos/maptiler-sdk.umd.js +3287 -0
- package/demos/simple.html +63 -0
- package/dist/maptiler-sdk.css +147 -0
- package/dist/maptiler-sdk.d.ts +531 -0
- package/dist/maptiler-sdk.min.mjs +1 -0
- package/dist/maptiler-sdk.mjs +1128 -0
- package/dist/maptiler-sdk.mjs.map +1 -0
- package/dist/maptiler-sdk.umd.js +3287 -0
- package/dist/maptiler-sdk.umd.js.map +1 -0
- package/dist/maptiler-sdk.umd.min.js +579 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/custom.css +118 -0
- package/docs/assets/highlight.css +134 -0
- package/docs/assets/main.js +54 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1257 -0
- package/docs/classes/Map.html +273 -0
- package/docs/classes/Point.html +549 -0
- package/docs/classes/SdkConfig.html +188 -0
- package/docs/demos/maptiler-sdk.css +147 -0
- package/docs/demos/maptiler-sdk.umd.js +3287 -0
- package/docs/demos/simple.html +63 -0
- package/docs/functions/addProtocol.html +146 -0
- package/docs/functions/clearPrewarmedResources.html +92 -0
- package/docs/functions/clearStorage.html +124 -0
- package/docs/functions/getRTLTextPluginStatus.html +92 -0
- package/docs/functions/prewarm.html +92 -0
- package/docs/functions/removeProtocol.html +106 -0
- package/docs/functions/setRTLTextPlugin.html +112 -0
- package/docs/functions/supported.html +97 -0
- package/docs/images/JS-logo.svg +4 -0
- package/docs/images/TS-logo.svg +6 -0
- package/docs/images/maptiler-logo.svg +19 -0
- package/docs/images/maptiler-sdk-logo.afdesign +0 -0
- package/docs/images/maptiler-sdk-logo.svg +66 -0
- package/docs/images/screenshots/alps.gif +0 -0
- package/docs/images/screenshots/grandcanyon.gif +0 -0
- package/docs/images/screenshots/lang-arabic.png +0 -0
- package/docs/images/screenshots/lang-hebrew.png +0 -0
- package/docs/images/screenshots/multilang.gif +0 -0
- package/docs/images/screenshots/static-bounded-europe-1024.png +0 -0
- package/docs/images/screenshots/static-bounded-europe-2048.png +0 -0
- package/docs/images/screenshots/static-bounded-portugal-1024x2048.png +0 -0
- package/docs/images/screenshots/static-bounded-portugal-2048x2048.png +0 -0
- package/docs/images/screenshots/static-with-path.png +0 -0
- package/docs/images/screenshots/style-basic-v2.png +0 -0
- package/docs/images/screenshots/style-bright.png +0 -0
- package/docs/images/screenshots/style-dataviz-dark.png +0 -0
- package/docs/images/screenshots/style-hybrid.png +0 -0
- package/docs/images/screenshots/style-osm.png +0 -0
- package/docs/images/screenshots/style-outdoor.png +0 -0
- package/docs/images/screenshots/style-pastel.png +0 -0
- package/docs/images/screenshots/style-satellite.png +0 -0
- package/docs/images/screenshots/style-streets-v2-dark.png +0 -0
- package/docs/images/screenshots/style-streets-v2-light.png +0 -0
- package/docs/images/screenshots/style-streets-v2.png +0 -0
- package/docs/images/screenshots/style-toner.png +0 -0
- package/docs/images/screenshots/style-topo.png +0 -0
- package/docs/images/screenshots/style-topographique.png +0 -0
- package/docs/images/screenshots/style-voyager.png +0 -0
- package/docs/images/screenshots/style-winter.png +0 -0
- package/docs/index.html +601 -0
- package/docs/modules.html +142 -0
- package/docs/types/LanguageKey.html +90 -0
- package/docs/types/LanguageString.html +90 -0
- package/docs/types/MapOptions.html +90 -0
- package/docs/types/Matrix2.html +90 -0
- package/docs/types/Unit.html +88 -0
- package/docs/variables/AJAXError.html +88 -0
- package/docs/variables/AttributionControl.html +88 -0
- package/docs/variables/CanvasSource.html +88 -0
- package/docs/variables/Evented.html +88 -0
- package/docs/variables/FullscreenControl.html +88 -0
- package/docs/variables/GeoJSONSource.html +88 -0
- package/docs/variables/GeolocateControl.html +88 -0
- package/docs/variables/GeolocationType.html +95 -0
- package/docs/variables/ImageSource.html +88 -0
- package/docs/variables/Language.html +249 -0
- package/docs/variables/LngLat.html +88 -0
- package/docs/variables/LngLatBounds.html +88 -0
- package/docs/variables/LogoControl.html +88 -0
- package/docs/variables/Marker.html +88 -0
- package/docs/variables/MercatorCoordinate.html +88 -0
- package/docs/variables/NavigationControl.html +88 -0
- package/docs/variables/Popup.html +88 -0
- package/docs/variables/RasterDEMTileSource.html +88 -0
- package/docs/variables/RasterTileSource.html +88 -0
- package/docs/variables/ScaleControl.html +88 -0
- package/docs/variables/Style.html +88 -0
- package/docs/variables/TerrainControl.html +88 -0
- package/docs/variables/VectorTileSource.html +88 -0
- package/docs/variables/VideoSource.html +88 -0
- package/docs/variables/config.html +88 -0
- package/docs/variables/maxParallelImageRequests.html +88 -0
- package/docs/variables/version.html +88 -0
- package/docs/variables/workerCount.html +88 -0
- package/docs/variables/workerUrl.html +88 -0
- package/docsmd/.nojekyll +1 -0
- package/docsmd/README.md +710 -0
- package/docsmd/assets/custom.css +118 -0
- package/docsmd/classes/Map.md +292 -0
- package/docsmd/classes/Point.md +603 -0
- package/docsmd/classes/SdkConfig.md +186 -0
- package/docsmd/images/JS-logo.svg +4 -0
- package/docsmd/images/TS-logo.svg +6 -0
- package/docsmd/images/maptiler-logo.svg +19 -0
- package/docsmd/images/maptiler-sdk-logo.afdesign +0 -0
- package/docsmd/images/maptiler-sdk-logo.svg +66 -0
- package/docsmd/images/screenshots/alps.gif +0 -0
- package/docsmd/images/screenshots/grandcanyon.gif +0 -0
- package/docsmd/images/screenshots/lang-arabic.png +0 -0
- package/docsmd/images/screenshots/lang-hebrew.png +0 -0
- package/docsmd/images/screenshots/multilang.gif +0 -0
- package/docsmd/images/screenshots/static-bounded-europe-1024.png +0 -0
- package/docsmd/images/screenshots/static-bounded-europe-2048.png +0 -0
- package/docsmd/images/screenshots/static-bounded-portugal-1024x2048.png +0 -0
- package/docsmd/images/screenshots/static-bounded-portugal-2048x2048.png +0 -0
- package/docsmd/images/screenshots/static-with-path.png +0 -0
- package/docsmd/images/screenshots/style-basic-v2.png +0 -0
- package/docsmd/images/screenshots/style-bright.png +0 -0
- package/docsmd/images/screenshots/style-dataviz-dark.png +0 -0
- package/docsmd/images/screenshots/style-hybrid.png +0 -0
- package/docsmd/images/screenshots/style-osm.png +0 -0
- package/docsmd/images/screenshots/style-outdoor.png +0 -0
- package/docsmd/images/screenshots/style-pastel.png +0 -0
- package/docsmd/images/screenshots/style-satellite.png +0 -0
- package/docsmd/images/screenshots/style-streets-v2-dark.png +0 -0
- package/docsmd/images/screenshots/style-streets-v2-light.png +0 -0
- package/docsmd/images/screenshots/style-streets-v2.png +0 -0
- package/docsmd/images/screenshots/style-toner.png +0 -0
- package/docsmd/images/screenshots/style-topo.png +0 -0
- package/docsmd/images/screenshots/style-topographique.png +0 -0
- package/docsmd/images/screenshots/style-voyager.png +0 -0
- package/docsmd/images/screenshots/style-winter.png +0 -0
- package/images/JS-logo.svg +4 -0
- package/images/TS-logo.svg +6 -0
- package/images/maptiler-logo.svg +19 -0
- package/images/maptiler-sdk-logo.afdesign +0 -0
- package/images/maptiler-sdk-logo.svg +66 -0
- package/images/screenshots/alps.gif +0 -0
- package/images/screenshots/grandcanyon.gif +0 -0
- package/images/screenshots/lang-arabic.png +0 -0
- package/images/screenshots/lang-hebrew.png +0 -0
- package/images/screenshots/multilang.gif +0 -0
- package/images/screenshots/static-bounded-europe-1024.png +0 -0
- package/images/screenshots/static-bounded-europe-2048.png +0 -0
- package/images/screenshots/static-bounded-portugal-1024x2048.png +0 -0
- package/images/screenshots/static-bounded-portugal-2048x2048.png +0 -0
- package/images/screenshots/static-with-path.png +0 -0
- package/images/screenshots/style-basic-v2.png +0 -0
- package/images/screenshots/style-bright.png +0 -0
- package/images/screenshots/style-dataviz-dark.png +0 -0
- package/images/screenshots/style-hybrid.png +0 -0
- package/images/screenshots/style-osm.png +0 -0
- package/images/screenshots/style-outdoor.png +0 -0
- package/images/screenshots/style-pastel.png +0 -0
- package/images/screenshots/style-satellite.png +0 -0
- package/images/screenshots/style-streets-v2-dark.png +0 -0
- package/images/screenshots/style-streets-v2-light.png +0 -0
- package/images/screenshots/style-streets-v2.png +0 -0
- package/images/screenshots/style-toner.png +0 -0
- package/images/screenshots/style-topo.png +0 -0
- package/images/screenshots/style-topographique.png +0 -0
- package/images/screenshots/style-voyager.png +0 -0
- package/images/screenshots/style-winter.png +0 -0
- package/package.json +71 -0
- package/readme.md +609 -0
- package/rollup.config.js +161 -0
- package/scripts/replace-path-with-content.js +51 -0
- package/src/CustomGeolocateControl.ts +193 -0
- package/src/CustomLogoControl.ts +59 -0
- package/src/Map.ts +897 -0
- package/src/MaptilerNavigationControl.ts +66 -0
- package/src/Point.ts +336 -0
- package/src/TerrainControl.ts +87 -0
- package/src/config.ts +92 -0
- package/src/defaults.ts +20 -0
- package/src/index.ts +171 -0
- package/src/language.ts +139 -0
- package/src/mapstyle.ts +38 -0
- package/src/style/style_template.css +146 -0
- package/src/style/svg/v6-compass.svg +12 -0
- package/src/style/svg/v6-fullscreen-off.svg +7 -0
- package/src/style/svg/v6-fullscreen.svg +7 -0
- package/src/style/svg/v6-geolocate-active-error.svg +10 -0
- package/src/style/svg/v6-geolocate-active.svg +7 -0
- package/src/style/svg/v6-geolocate-background.svg +8 -0
- package/src/style/svg/v6-geolocate-disabled.svg +10 -0
- package/src/style/svg/v6-geolocate.svg +7 -0
- package/src/style/svg/v6-terrain-on.svg +7 -0
- package/src/style/svg/v6-terrain.svg +7 -0
- package/src/style/svg/v6-zoom-minus.svg +7 -0
- package/src/style/svg/v6-zoom-plus.svg +7 -0
- package/src/tools.ts +45 -0
- package/src/unit.ts +1 -0
- package/tsconfig.json +11 -0
- package/typedoc.css +118 -0
- package/typedoc.json +13 -0
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
import * as maplibre_gl from 'maplibre-gl';
|
|
2
|
+
import maplibre_gl__default, { MapOptions as MapOptions$1, StyleSpecification, ControlPosition, StyleOptions } from 'maplibre-gl';
|
|
3
|
+
export * from 'maplibre-gl';
|
|
4
|
+
import * as _mapbox_mapbox_gl_supported from '@mapbox/mapbox-gl-supported';
|
|
5
|
+
import { ReferenceMapStyle, MapStyleVariant, FetchFunction } from '@maptiler/client';
|
|
6
|
+
export { AutomaticStaticMapOptions, BBox, BoundedStaticMapOptions, CenteredStaticMapOptions, CoordinatesSearchOptions, GeocodingOptions, LanguageGeocoding, LanguageGeocodingString, MapStyle, MapStyleType, MapStyleVariant, Position, ReferenceMapStyle, ServiceError, coordinates, data, geocoding, geolocation, staticMaps } from '@maptiler/client';
|
|
7
|
+
import EventEmitter from 'events';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Languages. Note that not all the languages of this list are available but the compatibility list may be expanded in the future.
|
|
11
|
+
*/
|
|
12
|
+
declare const Language: {
|
|
13
|
+
/**
|
|
14
|
+
* AUTO mode uses the language of the browser
|
|
15
|
+
*/
|
|
16
|
+
readonly AUTO: "auto";
|
|
17
|
+
/**
|
|
18
|
+
* Default fallback languages that uses latin charaters
|
|
19
|
+
*/
|
|
20
|
+
readonly LATIN: "latin";
|
|
21
|
+
/**
|
|
22
|
+
* Default fallback languages that uses non-latin charaters
|
|
23
|
+
*/
|
|
24
|
+
readonly NON_LATIN: "nonlatin";
|
|
25
|
+
/**
|
|
26
|
+
* Labels are in their local language, when available
|
|
27
|
+
*/
|
|
28
|
+
readonly LOCAL: "";
|
|
29
|
+
readonly ALBANIAN: "sq";
|
|
30
|
+
readonly AMHARIC: "am";
|
|
31
|
+
readonly ARABIC: "ar";
|
|
32
|
+
readonly ARMENIAN: "hy";
|
|
33
|
+
readonly AZERBAIJANI: "az";
|
|
34
|
+
readonly BASQUE: "eu";
|
|
35
|
+
readonly BELORUSSIAN: "be";
|
|
36
|
+
readonly BOSNIAN: "bs";
|
|
37
|
+
readonly BRETON: "br";
|
|
38
|
+
readonly BULGARIAN: "bg";
|
|
39
|
+
readonly CATALAN: "ca";
|
|
40
|
+
readonly CHINESE: "zh";
|
|
41
|
+
readonly CORSICAN: "co";
|
|
42
|
+
readonly CROATIAN: "hr";
|
|
43
|
+
readonly CZECH: "cs";
|
|
44
|
+
readonly DANISH: "da";
|
|
45
|
+
readonly DUTCH: "nl";
|
|
46
|
+
readonly ENGLISH: "en";
|
|
47
|
+
readonly ESPERANTO: "eo";
|
|
48
|
+
readonly ESTONIAN: "et";
|
|
49
|
+
readonly FINNISH: "fi";
|
|
50
|
+
readonly FRENCH: "fr";
|
|
51
|
+
readonly FRISIAN: "fy";
|
|
52
|
+
readonly GEORGIAN: "ka";
|
|
53
|
+
readonly GERMAN: "de";
|
|
54
|
+
readonly GREEK: "el";
|
|
55
|
+
readonly HEBREW: "he";
|
|
56
|
+
readonly HINDI: "hi";
|
|
57
|
+
readonly HUNGARIAN: "hu";
|
|
58
|
+
readonly ICELANDIC: "is";
|
|
59
|
+
readonly INDONESIAN: "id";
|
|
60
|
+
readonly IRISH: "ga";
|
|
61
|
+
readonly ITALIAN: "it";
|
|
62
|
+
readonly JAPANESE: "ja";
|
|
63
|
+
readonly JAPANESE_HIRAGANA: "ja-Hira";
|
|
64
|
+
readonly JAPANESE_KANA: "ja_kana";
|
|
65
|
+
readonly JAPANESE_LATIN: "ja_rm";
|
|
66
|
+
readonly JAPANESE_2018: "ja-Latn";
|
|
67
|
+
readonly KANNADA: "kn";
|
|
68
|
+
readonly KAZAKH: "kk";
|
|
69
|
+
readonly KOREAN: "ko";
|
|
70
|
+
readonly KOREAN_LATIN: "ko-Latn";
|
|
71
|
+
readonly KURDISH: "ku";
|
|
72
|
+
readonly ROMAN_LATIN: "la";
|
|
73
|
+
readonly LATVIAN: "lv";
|
|
74
|
+
readonly LITHUANIAN: "lt";
|
|
75
|
+
readonly LUXEMBOURGISH: "lb";
|
|
76
|
+
readonly MACEDONIAN: "mk";
|
|
77
|
+
readonly MALAYALAM: "ml";
|
|
78
|
+
readonly MALTESE: "mt";
|
|
79
|
+
readonly NORWEGIAN: "no";
|
|
80
|
+
readonly OCCITAN: "oc";
|
|
81
|
+
readonly POLISH: "pl";
|
|
82
|
+
readonly PORTUGUESE: "pt";
|
|
83
|
+
readonly ROMANIAN: "ro";
|
|
84
|
+
readonly ROMANSH: "rm";
|
|
85
|
+
readonly RUSSIAN: "ru";
|
|
86
|
+
readonly SCOTTISH_GAELIC: "gd";
|
|
87
|
+
readonly SERBIAN_CYRILLIC: "sr";
|
|
88
|
+
readonly SERBIAN_LATIN: "sr-Latn";
|
|
89
|
+
readonly SLOVAK: "sk";
|
|
90
|
+
readonly SLOVENE: "sl";
|
|
91
|
+
readonly SPANISH: "es";
|
|
92
|
+
readonly SWEDISH: "sv";
|
|
93
|
+
readonly TAMIL: "ta";
|
|
94
|
+
readonly TELUGU: "te";
|
|
95
|
+
readonly THAI: "th";
|
|
96
|
+
readonly TURKISH: "tr";
|
|
97
|
+
readonly UKRAINIAN: "uk";
|
|
98
|
+
readonly WELSH: "cy";
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Type representing the key of the Language object
|
|
102
|
+
*/
|
|
103
|
+
declare type LanguageKey = keyof typeof Language;
|
|
104
|
+
declare type Values<T> = T[keyof T];
|
|
105
|
+
/**
|
|
106
|
+
* Built-in languages values as strings
|
|
107
|
+
*/
|
|
108
|
+
declare type LanguageString = Values<typeof Language>;
|
|
109
|
+
|
|
110
|
+
declare type TransformStyleFunction = (previous: StyleSpecification, next: StyleSpecification) => StyleSpecification;
|
|
111
|
+
declare type StyleSwapOptions = {
|
|
112
|
+
diff?: boolean;
|
|
113
|
+
transformStyle?: TransformStyleFunction;
|
|
114
|
+
};
|
|
115
|
+
declare const GeolocationType: {
|
|
116
|
+
POINT: "POINT";
|
|
117
|
+
COUNTRY: "COUNTRY";
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Options to provide to the `Map` constructor
|
|
121
|
+
*/
|
|
122
|
+
declare type MapOptions = Omit<MapOptions$1, "style" | "maplibreLogo"> & {
|
|
123
|
+
/**
|
|
124
|
+
* Style of the map. Can be:
|
|
125
|
+
* - a full style URL (possibly with API key)
|
|
126
|
+
* - a shorthand with only the MapTIler style name (eg. `"streets-v2"`)
|
|
127
|
+
* - a longer form with the prefix `"maptiler://"` (eg. `"maptiler://streets-v2"`)
|
|
128
|
+
*/
|
|
129
|
+
style?: ReferenceMapStyle | MapStyleVariant | StyleSpecification | string;
|
|
130
|
+
/**
|
|
131
|
+
* Shows the MapTiler logo if `true`. Note that the logo is always displayed on free plan.
|
|
132
|
+
*/
|
|
133
|
+
maptilerLogo?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Enables 3D terrain if `true`. (default: `false`)
|
|
136
|
+
*/
|
|
137
|
+
terrain?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Exaggeration factor of the terrain. (default: `1`, no exaggeration)
|
|
140
|
+
*/
|
|
141
|
+
terrainExaggeration?: number;
|
|
142
|
+
/**
|
|
143
|
+
* Show the navigation control. (default: `true`, will hide if `false`)
|
|
144
|
+
*/
|
|
145
|
+
navigationControl?: boolean | ControlPosition;
|
|
146
|
+
/**
|
|
147
|
+
* Show the terrain control. (default: `false`, will show if `true`)
|
|
148
|
+
*/
|
|
149
|
+
terrainControl?: boolean | ControlPosition;
|
|
150
|
+
/**
|
|
151
|
+
* Show the geolocate control. (default: `true`, will hide if `false`)
|
|
152
|
+
*/
|
|
153
|
+
geolocateControl?: boolean | ControlPosition;
|
|
154
|
+
/**
|
|
155
|
+
* Show the scale control. (default: `false`, will show if `true`)
|
|
156
|
+
*/
|
|
157
|
+
scaleControl?: boolean | ControlPosition;
|
|
158
|
+
/**
|
|
159
|
+
* Show the full screen control. (default: `false`, will show if `true`)
|
|
160
|
+
*/
|
|
161
|
+
fullscreenControl?: boolean | ControlPosition;
|
|
162
|
+
/**
|
|
163
|
+
* Method to position the map at a given geolocation. Only if:
|
|
164
|
+
* - `hash` is `false`
|
|
165
|
+
* - `center` is not provided
|
|
166
|
+
*
|
|
167
|
+
* If the value is `true` of `"POINT"` (given by `GeolocationType.POINT`) then the positionning uses the MapTiler Cloud
|
|
168
|
+
* Geolocation to find the non-GPS location point.
|
|
169
|
+
* The zoom level can be provided in the `Map` constructor with the `zoom` option or will be `13` if not provided.
|
|
170
|
+
*
|
|
171
|
+
* If the value is `"COUNTRY"` (given by `GeolocationType.COUNTRY`) then the map is centered around the bounding box of the country.
|
|
172
|
+
* In this case, the `zoom` option will be ignored.
|
|
173
|
+
*
|
|
174
|
+
* If the value is `false`, no geolocation is performed and the map centering and zooming depends on other options or on
|
|
175
|
+
* the built-in defaults.
|
|
176
|
+
*
|
|
177
|
+
* If this option is non-false and the options `center` is also provided, then `center` prevails.
|
|
178
|
+
*
|
|
179
|
+
* Default: `false`
|
|
180
|
+
*/
|
|
181
|
+
geolocate?: typeof GeolocationType[keyof typeof GeolocationType] | boolean;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* The Map class can be instanciated to display a map in a `<div>`
|
|
185
|
+
*/
|
|
186
|
+
declare class Map extends maplibre_gl__default.Map {
|
|
187
|
+
private languageShouldUpdate;
|
|
188
|
+
private isStyleInitialized;
|
|
189
|
+
private isTerrainEnabled;
|
|
190
|
+
private terrainExaggeration;
|
|
191
|
+
constructor(options: MapOptions);
|
|
192
|
+
/**
|
|
193
|
+
* Update the style of the map.
|
|
194
|
+
* Can be:
|
|
195
|
+
* - a full style URL (possibly with API key)
|
|
196
|
+
* - a shorthand with only the MapTIler style name (eg. `"streets-v2"`)
|
|
197
|
+
* - a longer form with the prefix `"maptiler://"` (eg. `"maptiler://streets-v2"`)
|
|
198
|
+
* @param style
|
|
199
|
+
* @param options
|
|
200
|
+
* @returns
|
|
201
|
+
*/
|
|
202
|
+
setStyle(style: ReferenceMapStyle | MapStyleVariant | StyleSpecification | string, options?: StyleSwapOptions & StyleOptions): this;
|
|
203
|
+
/**
|
|
204
|
+
* Define the primary language of the map. Note that not all the languages shorthands provided are available.
|
|
205
|
+
* This function is a short for `.setPrimaryLanguage()`
|
|
206
|
+
* @param language
|
|
207
|
+
*/
|
|
208
|
+
setLanguage(language?: LanguageString): any;
|
|
209
|
+
/**
|
|
210
|
+
* Define the primary language of the map. Note that not all the languages shorthands provided are available.
|
|
211
|
+
* @param language
|
|
212
|
+
*/
|
|
213
|
+
setPrimaryLanguage(language?: LanguageString): void;
|
|
214
|
+
/**
|
|
215
|
+
* Define the secondary language of the map.
|
|
216
|
+
* Note that most styles do not allow a secondary language and this function only works if the style allows (no force adding)
|
|
217
|
+
* @param language
|
|
218
|
+
*/
|
|
219
|
+
setSecondaryLanguage(language?: LanguageString): void;
|
|
220
|
+
/**
|
|
221
|
+
* Get the exaggeration factor applied to the terrain
|
|
222
|
+
* @returns
|
|
223
|
+
*/
|
|
224
|
+
getTerrainExaggeration(): number;
|
|
225
|
+
/**
|
|
226
|
+
* Know if terrian is enabled or not
|
|
227
|
+
* @returns
|
|
228
|
+
*/
|
|
229
|
+
hasTerrain(): boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Enables the 3D terrain visualization
|
|
232
|
+
* @param exaggeration
|
|
233
|
+
* @returns
|
|
234
|
+
*/
|
|
235
|
+
enableTerrain(exaggeration?: number): void;
|
|
236
|
+
/**
|
|
237
|
+
* Disable the 3D terrain visualization
|
|
238
|
+
*/
|
|
239
|
+
disableTerrain(): void;
|
|
240
|
+
/**
|
|
241
|
+
* Sets the 3D terrain exageration factor.
|
|
242
|
+
* Note: this is only a shortcut to `.enableTerrain()`
|
|
243
|
+
* @param exaggeration
|
|
244
|
+
*/
|
|
245
|
+
setTerrainExaggeration(exaggeration: number): void;
|
|
246
|
+
/**
|
|
247
|
+
* Perform an action when the style is ready. It could be at the moment of calling this method
|
|
248
|
+
* or later.
|
|
249
|
+
* @param cb
|
|
250
|
+
*/
|
|
251
|
+
private onStyleReady;
|
|
252
|
+
fitToIpBounds(): Promise<void>;
|
|
253
|
+
centerOnIpPoint(zoom: number | undefined): Promise<void>;
|
|
254
|
+
getCameraHash(): string;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* This is TypeScript rewrite of the Point class to use instead of the version imported in MapLibre.
|
|
259
|
+
* It also uses a class instead of prototypes.
|
|
260
|
+
*/
|
|
261
|
+
/**
|
|
262
|
+
* Row major 2x2 matrix
|
|
263
|
+
*/
|
|
264
|
+
declare type Matrix2 = [number, number, number, number];
|
|
265
|
+
/**
|
|
266
|
+
* a point
|
|
267
|
+
* @param x
|
|
268
|
+
* @param y
|
|
269
|
+
*/
|
|
270
|
+
declare class Point {
|
|
271
|
+
x: number;
|
|
272
|
+
y: number;
|
|
273
|
+
constructor(x: number, y: number);
|
|
274
|
+
private _matMult;
|
|
275
|
+
private _add;
|
|
276
|
+
private _sub;
|
|
277
|
+
private _mult;
|
|
278
|
+
private _div;
|
|
279
|
+
private _multByPoint;
|
|
280
|
+
private _divByPoint;
|
|
281
|
+
private _unit;
|
|
282
|
+
private _perp;
|
|
283
|
+
private _rotate;
|
|
284
|
+
private _rotateAround;
|
|
285
|
+
private _round;
|
|
286
|
+
/**
|
|
287
|
+
* Clone this point, returning a new point that can be modified
|
|
288
|
+
* without affecting the old one.
|
|
289
|
+
* @return {Point} the clone
|
|
290
|
+
*/
|
|
291
|
+
clone(): Point;
|
|
292
|
+
/**
|
|
293
|
+
* Add this point's x & y coordinates to another point,
|
|
294
|
+
* yielding a new point.
|
|
295
|
+
* @param {Point} p the other point
|
|
296
|
+
* @return {Point} output point
|
|
297
|
+
*/
|
|
298
|
+
add(p: Point): Point;
|
|
299
|
+
/**
|
|
300
|
+
* Subtract this point's x & y coordinates to from point,
|
|
301
|
+
* yielding a new point.
|
|
302
|
+
* @param {Point} p the other point
|
|
303
|
+
* @return {Point} output point
|
|
304
|
+
*/
|
|
305
|
+
sub(p: Point): Point;
|
|
306
|
+
/**
|
|
307
|
+
* Multiply this point's x & y coordinates by point,
|
|
308
|
+
* yielding a new point.
|
|
309
|
+
* @param {Point} p the other point
|
|
310
|
+
* @return {Point} output point
|
|
311
|
+
*/
|
|
312
|
+
multByPoint(p: Point): Point;
|
|
313
|
+
/**
|
|
314
|
+
* Divide this point's x & y coordinates by point,
|
|
315
|
+
* yielding a new point.
|
|
316
|
+
* @param {Point} p the other point
|
|
317
|
+
* @return {Point} output point
|
|
318
|
+
*/
|
|
319
|
+
divByPoint(p: Point): Point;
|
|
320
|
+
/**
|
|
321
|
+
* Multiply this point's x & y coordinates by a factor,
|
|
322
|
+
* yielding a new point.
|
|
323
|
+
* @param {Number} k factor
|
|
324
|
+
* @return {Point} output point
|
|
325
|
+
*/
|
|
326
|
+
mult(k: number): Point;
|
|
327
|
+
/**
|
|
328
|
+
* Divide this point's x & y coordinates by a factor,
|
|
329
|
+
* yielding a new point.
|
|
330
|
+
* @param {Point} k factor
|
|
331
|
+
* @return {Point} output point
|
|
332
|
+
*/
|
|
333
|
+
div(k: number): Point;
|
|
334
|
+
/**
|
|
335
|
+
* Rotate this point around the 0, 0 origin by an angle a,
|
|
336
|
+
* given in radians
|
|
337
|
+
* @param {Number} a angle to rotate around, in radians
|
|
338
|
+
* @return {Point} output point
|
|
339
|
+
*/
|
|
340
|
+
rotate(a: number): Point;
|
|
341
|
+
/**
|
|
342
|
+
* Rotate this point around p point by an angle a,
|
|
343
|
+
* given in radians
|
|
344
|
+
* @param {Number} a angle to rotate around, in radians
|
|
345
|
+
* @param {Point} p Point to rotate around
|
|
346
|
+
* @return {Point} output point
|
|
347
|
+
*/
|
|
348
|
+
rotateAround(a: number, p: Point): Point;
|
|
349
|
+
/**
|
|
350
|
+
* Multiply this point by a 4x1 transformation matrix
|
|
351
|
+
* @param {Array<Number>} m transformation matrix
|
|
352
|
+
* @return {Point} output point
|
|
353
|
+
*/
|
|
354
|
+
matMult(m: Matrix2): Point;
|
|
355
|
+
/**
|
|
356
|
+
* Calculate this point but as a unit vector from 0, 0, meaning
|
|
357
|
+
* that the distance from the resulting point to the 0, 0
|
|
358
|
+
* coordinate will be equal to 1 and the angle from the resulting
|
|
359
|
+
* point to the 0, 0 coordinate will be the same as before.
|
|
360
|
+
* @return {Point} unit vector point
|
|
361
|
+
*/
|
|
362
|
+
unit(): Point;
|
|
363
|
+
/**
|
|
364
|
+
* Compute a perpendicular point, where the new y coordinate
|
|
365
|
+
* is the old x coordinate and the new x coordinate is the old y
|
|
366
|
+
* coordinate multiplied by -1
|
|
367
|
+
* @return {Point} perpendicular point
|
|
368
|
+
*/
|
|
369
|
+
perp(): Point;
|
|
370
|
+
/**
|
|
371
|
+
* Return a version of this point with the x & y coordinates
|
|
372
|
+
* rounded to integers.
|
|
373
|
+
* @return {Point} rounded point
|
|
374
|
+
*/
|
|
375
|
+
round(): Point;
|
|
376
|
+
/**
|
|
377
|
+
* Return the magnitude of this point: this is the Euclidean
|
|
378
|
+
* distance from the 0, 0 coordinate to this point's x and y
|
|
379
|
+
* coordinates.
|
|
380
|
+
* @return {Number} magnitude
|
|
381
|
+
*/
|
|
382
|
+
mag(): number;
|
|
383
|
+
/**
|
|
384
|
+
* Judge whether this point is equal to another point, returning
|
|
385
|
+
* true or false.
|
|
386
|
+
* @param {Point} other the other point
|
|
387
|
+
* @return {boolean} whether the points are equal
|
|
388
|
+
*/
|
|
389
|
+
equals(other: any): boolean;
|
|
390
|
+
/**
|
|
391
|
+
* Calculate the distance from this point to another point
|
|
392
|
+
* @param {Point} p the other point
|
|
393
|
+
* @return {Number} distance
|
|
394
|
+
*/
|
|
395
|
+
dist(p: any): number;
|
|
396
|
+
/**
|
|
397
|
+
* Calculate the distance from this point to another point,
|
|
398
|
+
* without the square root step. Useful if you're comparing
|
|
399
|
+
* relative distances.
|
|
400
|
+
* @param {Point} p the other point
|
|
401
|
+
* @return {Number} distance
|
|
402
|
+
*/
|
|
403
|
+
distSqr(p: any): number;
|
|
404
|
+
/**
|
|
405
|
+
* Get the angle from the 0, 0 coordinate to this point, in radians
|
|
406
|
+
* coordinates.
|
|
407
|
+
* @return {Number} angle
|
|
408
|
+
*/
|
|
409
|
+
angle(): number;
|
|
410
|
+
/**
|
|
411
|
+
* Get the angle from this point to another point, in radians
|
|
412
|
+
* @param {Point} b the other point
|
|
413
|
+
* @return {Number} angle
|
|
414
|
+
*/
|
|
415
|
+
angleTo(b: Point): number;
|
|
416
|
+
/**
|
|
417
|
+
* Get the angle between this point and another point, in radians
|
|
418
|
+
* @param {Point} b the other point
|
|
419
|
+
* @return {Number} angle
|
|
420
|
+
*/
|
|
421
|
+
angleWith(b: Point): number;
|
|
422
|
+
angleWithSep(x: number, y: number): number;
|
|
423
|
+
/**
|
|
424
|
+
* Construct a point from an array if necessary, otherwise if the input
|
|
425
|
+
* is already a Point, or an unknown type, return it unchanged
|
|
426
|
+
* @param {Array<number> | Point} a any kind of input value
|
|
427
|
+
* @return {Point} constructed point, or passed-through value.
|
|
428
|
+
* @example
|
|
429
|
+
* // this
|
|
430
|
+
* var point = Point.convert([0, 1]);
|
|
431
|
+
* // is equivalent to
|
|
432
|
+
* var point = new Point(0, 1);
|
|
433
|
+
*/
|
|
434
|
+
static convert(a: Point | Array<number>): Point;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
declare type Unit = "imperial" | "metric" | "nautical";
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Configuration class for the SDK
|
|
441
|
+
*/
|
|
442
|
+
declare class SdkConfig extends EventEmitter {
|
|
443
|
+
/**
|
|
444
|
+
* The primary language. By default, the language of the web browser is used.
|
|
445
|
+
*/
|
|
446
|
+
primaryLanguage: LanguageString | null;
|
|
447
|
+
/**
|
|
448
|
+
* The secondary language, to overwrite the default language defined in the map style.
|
|
449
|
+
* This settings is highly dependant on the style compatibility and may not work in most cases.
|
|
450
|
+
*/
|
|
451
|
+
secondaryLanguage: LanguageString | null;
|
|
452
|
+
/**
|
|
453
|
+
* Setting on whether of not the SDK runs with a session logic.
|
|
454
|
+
* A "session" is started at the initialization of the SDK and finished when the browser
|
|
455
|
+
* page is being refreshed.
|
|
456
|
+
* When `session` is enabled (default: true), the extra URL param `mtsid` is added to queries
|
|
457
|
+
* on the MapTiler Cloud API. This allows MapTiler to enable "session based billing".
|
|
458
|
+
*/
|
|
459
|
+
session: boolean;
|
|
460
|
+
/**
|
|
461
|
+
* Unit to be used
|
|
462
|
+
*/
|
|
463
|
+
private _unit;
|
|
464
|
+
/**
|
|
465
|
+
* MapTiler Cloud API key
|
|
466
|
+
*/
|
|
467
|
+
private _apiKey;
|
|
468
|
+
constructor();
|
|
469
|
+
/**
|
|
470
|
+
* Set the unit system
|
|
471
|
+
*/
|
|
472
|
+
set unit(u: Unit);
|
|
473
|
+
/**
|
|
474
|
+
* Get the unit system
|
|
475
|
+
*/
|
|
476
|
+
get unit(): Unit;
|
|
477
|
+
/**
|
|
478
|
+
* Set the MapTiler Cloud API key
|
|
479
|
+
*/
|
|
480
|
+
set apiKey(k: string);
|
|
481
|
+
/**
|
|
482
|
+
* Get the MapTiler Cloud API key
|
|
483
|
+
*/
|
|
484
|
+
get apiKey(): string;
|
|
485
|
+
/**
|
|
486
|
+
* Set a the custom fetch function to replace the default one
|
|
487
|
+
*/
|
|
488
|
+
set fetch(f: FetchFunction);
|
|
489
|
+
/**
|
|
490
|
+
* Get the fetch fucntion
|
|
491
|
+
*/
|
|
492
|
+
get fetch(): FetchFunction | null;
|
|
493
|
+
}
|
|
494
|
+
declare const config: SdkConfig;
|
|
495
|
+
|
|
496
|
+
declare const supported: _mapbox_mapbox_gl_supported.IsSupported;
|
|
497
|
+
declare const setRTLTextPlugin: (url: string, callback: (error?: Error) => void, deferred?: boolean) => void;
|
|
498
|
+
declare const getRTLTextPluginStatus: () => string;
|
|
499
|
+
declare const NavigationControl: typeof maplibre_gl.NavigationControl;
|
|
500
|
+
declare const GeolocateControl: typeof maplibre_gl.GeolocateControl;
|
|
501
|
+
declare const AttributionControl: typeof maplibre_gl.AttributionControl;
|
|
502
|
+
declare const LogoControl: typeof maplibre_gl.LogoControl;
|
|
503
|
+
declare const ScaleControl: typeof maplibre_gl.ScaleControl;
|
|
504
|
+
declare const FullscreenControl: typeof maplibre_gl.FullscreenControl;
|
|
505
|
+
declare const TerrainControl: typeof maplibre_gl.TerrainControl;
|
|
506
|
+
declare const Popup: typeof maplibre_gl.Popup;
|
|
507
|
+
declare const Marker: typeof maplibre_gl.Marker;
|
|
508
|
+
declare const Style: typeof maplibre_gl.Style;
|
|
509
|
+
declare const LngLat: typeof maplibre_gl.LngLat;
|
|
510
|
+
declare const LngLatBounds: typeof maplibre_gl.LngLatBounds;
|
|
511
|
+
declare const MercatorCoordinate: typeof maplibre_gl.MercatorCoordinate;
|
|
512
|
+
declare const Evented: typeof maplibre_gl.Evented;
|
|
513
|
+
declare const AJAXError: typeof maplibre_gl.AJAXError;
|
|
514
|
+
declare const CanvasSource: typeof maplibre_gl.CanvasSource;
|
|
515
|
+
declare const GeoJSONSource: typeof maplibre_gl.GeoJSONSource;
|
|
516
|
+
declare const ImageSource: typeof maplibre_gl.ImageSource;
|
|
517
|
+
declare const RasterDEMTileSource: typeof maplibre_gl.RasterDEMTileSource;
|
|
518
|
+
declare const RasterTileSource: typeof maplibre_gl.RasterTileSource;
|
|
519
|
+
declare const VectorTileSource: typeof maplibre_gl.VectorTileSource;
|
|
520
|
+
declare const VideoSource: typeof maplibre_gl.VideoSource;
|
|
521
|
+
declare const prewarm: () => void;
|
|
522
|
+
declare const clearPrewarmedResources: () => void;
|
|
523
|
+
declare const version: string;
|
|
524
|
+
declare const workerCount: number;
|
|
525
|
+
declare const maxParallelImageRequests: number;
|
|
526
|
+
declare const clearStorage: (callback?: (err?: Error) => void) => void;
|
|
527
|
+
declare const workerUrl: string;
|
|
528
|
+
declare const addProtocol: (customProtocol: string, loadFn: (requestParameters: maplibre_gl.RequestParameters, callback: maplibre_gl.ResponseCallback<any>) => maplibre_gl.Cancelable) => void;
|
|
529
|
+
declare const removeProtocol: (customProtocol: string) => void;
|
|
530
|
+
|
|
531
|
+
export { AJAXError, AttributionControl, CanvasSource, Evented, FullscreenControl, GeoJSONSource, GeolocateControl, GeolocationType, ImageSource, Language, LanguageKey, LanguageString, LngLat, LngLatBounds, LogoControl, Map, MapOptions, Marker, Matrix2, MercatorCoordinate, NavigationControl, Point, Popup, RasterDEMTileSource, RasterTileSource, ScaleControl, SdkConfig, Style, TerrainControl, Unit, VectorTileSource, VideoSource, addProtocol, clearPrewarmedResources, clearStorage, config, getRTLTextPluginStatus, maxParallelImageRequests, prewarm, removeProtocol, setRTLTextPlugin, supported, version, workerCount, workerUrl };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import S,{GeolocateControl as H,LngLat as j,Marker as I}from"maplibre-gl";export*from"maplibre-gl";import{Base64 as G}from"js-base64";import{v4 as K}from"uuid";import D from"events";import{config as b,expandMapStyle as z,MapStyleVariant as F,ReferenceMapStyle as V,MapStyle as Z,mapStylePresetList as q,geolocation as v}from"@maptiler/client";import{LanguageGeocoding as re,MapStyle as ie,MapStyleVariant as ae,ReferenceMapStyle as oe,ServiceError as ne,coordinates as se,data as le,geocoding as ce,geolocation as he,staticMaps as ue}from"@maptiler/client";const f={AUTO:"auto",LATIN:"latin",NON_LATIN:"nonlatin",LOCAL:"",ALBANIAN:"sq",AMHARIC:"am",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BASQUE:"eu",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CORSICAN:"co",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HINDI:"hi",HUNGARIAN:"hu",ICELANDIC:"is",INDONESIAN:"id",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",JAPANESE_HIRAGANA:"ja-Hira",JAPANESE_KANA:"ja_kana",JAPANESE_LATIN:"ja_rm",JAPANESE_2018:"ja-Latn",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",KOREAN_LATIN:"ko-Latn",KURDISH:"ku",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALAYALAM:"ml",MALTESE:"mt",NORWEGIAN:"no",OCCITAN:"oc",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SERBIAN_LATIN:"sr-Latn",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",TAMIL:"ta",TELUGU:"te",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},J=new Set(Object.values(f));function E(r){return J.has(r)}const W=new Set(Object.values(f));function T(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const r=Array.from(new Set(navigator.languages.map(t=>t.split("-")[0]))).filter(t=>W.has(t));return r.length?r[0]:f.LATIN}class N extends D{constructor(){super(),this.primaryLanguage=f.AUTO,this.secondaryLanguage=null,this.session=!0,this._unit="metric",this._apiKey=""}set unit(t){this._unit=t,this.emit("unit",t)}get unit(){return this._unit}set apiKey(t){this._apiKey=t,b.apiKey=t,this.emit("apiKey",t)}get apiKey(){return this._apiKey}set fetch(t){b.fetch=t}get fetch(){return b.fetch}}const g=new N,d={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:f.AUTO,secondaryLanguage:f.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(d);class w extends S.LogoControl{constructor(t={}){var e,a;super(t),this.logoURL="",this.linkURL="",this.logoURL=(e=t.logoURL)!=null?e:d.maptilerLogoURL,this.linkURL=(a=t.linkURL)!=null?a:d.maptilerURL}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const e=window.document.createElement("a");return e.style.backgroundRepeat="no-repeat",e.style.cursor="pointer",e.style.display="block",e.style.height="23px",e.style.margin="0 0 -4px -4px",e.style.overflow="hidden",e.style.width="88px",e.style.backgroundImage=`url(${this.logoURL})`,e.style.backgroundSize="100px 30px",e.style.width="100px",e.style.height="30px",e.target="_blank",e.rel="noopener nofollow",e.href=this.linkURL,e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}function Y(){S.getRTLTextPluginStatus()==="unavailable"&&S.setRTLTextPlugin(d.rtlPluginURL,null,!0)}function X(r,t){r.forEach(e=>{!t[e]||(t[e]=t[e].bind(t))})}function A(r,t,e){const a=window.document.createElement(r);return t!==void 0&&(a.className=t),e&&e.appendChild(a),a}function Q(r){r.parentNode&&r.parentNode.removeChild(r)}function R(r){return r?typeof r=="string"||r instanceof String?z(r):r instanceof F?r.getExpandedStyleURL():r instanceof V?r.getDefaultVariant().getExpandedStyleURL():r:Z[q[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}class tt{constructor(){X(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(t){return this._map=t,this._container=A("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=A("button","maplibregl-ctrl-terrain",this._container),A("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){Q(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}}class et extends S.NavigationControl{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",t=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})}_createButton(t,e){const a=super._createButton(t,e);return a.clickFunction=e,a}_rotateCompassArrow(){const t=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) rotateX(${Math.min(70,this._map.transform.pitch)}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t}}var rt=Object.defineProperty,P=Object.getOwnPropertySymbols,it=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable,U=(r,t,e)=>t in r?rt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ot=(r,t)=>{for(var e in t||(t={}))it.call(t,e)&&U(r,e,t[e]);if(P)for(var e of P(t))at.call(t,e)&&U(r,e,t[e]);return r};class nt extends H{_updateCamera(t){const e=new j(t.coords.longitude,t.coords.latitude),a=t.coords.accuracy,h=this._map.getBearing(),c=ot({bearing:h},this.options.fitBoundsOptions);console.log("moving camera"),this._map.fitBounds(e.toBounds(a),c,{geolocateSource:!0});let i=!1;const o=()=>{console.log("DISRUPTED FITTING!"),i=!0};this._map.once("click",o),this._map.once("dblclick",o),this._map.once("dragstart",o),this._map.once("mousedown",o),this._map.once("touchstart",o),this._map.once("wheel",o),this._map.once("moveend",()=>{console.log("done moving, with disruption:",i),this._map.off("click",o),this._map.off("dblclick",o),this._map.off("dragstart",o),this._map.off("mousedown",o),this._map.off("touchstart",o),this._map.off("wheel",o),!i&&(this.lastUpdatedCenter=this._map.getCenter(),this.lastUpdatedZoom=this._map.getZoom())})}_setupUI(t){if(this.lastUpdatedCenter=this._map.getCenter(),this.lastUpdatedZoom=this._map.getZoom(),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=A("button","maplibregl-ctrl-geolocate",this._container),A("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=A("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new I(this._dotElement),this._circleElement=A("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new I({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",e=>{const a=e.originalEvent&&e.originalEvent.type==="resize",h=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!e.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!a&&h>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const t=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],e=this._map.project(t),a=this._map.unproject([e.x,e.y]),h=this._map.unproject([e.x+20,e.y]),c=a.distanceTo(h)/20,i=Math.ceil(2*this._accuracy/c);this._circleElement.style.width=`${i}px`,this._circleElement.style.height=`${i}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}}var st=Object.defineProperty,lt=Object.defineProperties,ct=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,ht=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable,k=(r,t,e)=>t in r?st(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,M=(r,t)=>{for(var e in t||(t={}))ht.call(t,e)&&k(r,e,t[e]);if(O)for(var e of O(t))ut.call(t,e)&&k(r,e,t[e]);return r},B=(r,t)=>lt(r,ct(t)),C=(r,t,e)=>new Promise((a,h)=>{var c=s=>{try{o(e.next(s))}catch(m){h(m)}},i=s=>{try{o(e.throw(s))}catch(m){h(m)}},o=s=>s.done?a(s.value):Promise.resolve(s.value).then(c,i);o((e=e.apply(r,t)).next())});const gt=K(),$={POINT:"POINT",COUNTRY:"COUNTRY"};class dt extends S.Map{constructor(t){var e;const a=R(t.style);console.log(a);const h=location.hash;g.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(B(M({},t),{style:a,maplibreLogo:!1,transformRequest:c=>{const i=new URL(c);return i.host===d.maptilerApiHost&&(i.searchParams.has("key")||i.searchParams.append("key",g.apiKey),g.session&&i.searchParams.append("mtsid",gt)),{url:i.href,headers:{}}}})),this.languageShouldUpdate=!1,this.isStyleInitialized=!1,this.isTerrainEnabled=!1,this.terrainExaggeration=1,this.once("styledata",()=>C(this,null,function*(){if(t.geolocate===!1||t.center||t.hash&&!!h)return;try{if(t.geolocate===$.COUNTRY){yield this.fitToIpBounds();return}}catch(i){console.warn(i.message)}let c=null;try{yield this.centerOnIpPoint(t.zoom),c=this.getCameraHash()}catch(i){console.warn(i.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(i=>{c===this.getCameraHash()&&this.easeTo({center:[i.coords.longitude,i.coords.latitude],zoom:t.zoom||12,duration:2e3})},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledataloading",()=>{this.languageShouldUpdate=!!g.primaryLanguage||!!g.secondaryLanguage}),this.on("styledata",()=>{g.primaryLanguage&&(this.languageShouldUpdate||!this.isStyleInitialized)&&this.setPrimaryLanguage(g.primaryLanguage),g.secondaryLanguage&&(this.languageShouldUpdate||!this.isStyleInitialized)&&this.setSecondaryLanguage(g.secondaryLanguage),this.languageShouldUpdate=!1,this.isStyleInitialized=!0}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",()=>C(this,null,function*(){Y()})),this.once("load",()=>C(this,null,function*(){let c={logo:null};try{const i=Object.keys(this.style.sourceCaches).map(s=>this.getSource(s)).filter(s=>typeof s.url=="string"&&s.url.includes("tiles.json")),o=new URL(i[0].url);o.searchParams.has("key")||o.searchParams.append("key",g.apiKey),c=yield(yield fetch(o.href)).json()}catch{}if("logo"in c&&c.logo){const i=c.logo;this.addControl(new w({logoURL:i}),t.logoPosition),t.attributionControl===!1&&this.addControl(new S.AttributionControl(t))}else t.maptilerLogo&&this.addControl(new w,t.logoPosition);if(t.scaleControl){const i=t.scaleControl===!0||t.scaleControl===void 0?"bottom-right":t.scaleControl,o=new S.ScaleControl({unit:g.unit});this.addControl(o,i),g.on("unit",s=>{o.setUnit(s)})}if(t.navigationControl!==!1){const i=t.navigationControl===!0||t.navigationControl===void 0?"top-right":t.navigationControl;this.addControl(new et,i)}if(t.geolocateControl!==!1){const i=t.geolocateControl===!0||t.geolocateControl===void 0?"top-right":t.geolocateControl;this.addControl(new nt({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),i)}if(t.terrainControl){const i=t.terrainControl===!0||t.terrainControl===void 0?"top-right":t.terrainControl;this.addControl(new tt,i)}if(t.fullscreenControl){const i=t.fullscreenControl===!0||t.fullscreenControl===void 0?"top-right":t.fullscreenControl;this.addControl(new S.FullscreenControl({}),i)}})),t.terrain&&this.enableTerrain((e=t.terrainExaggeration)!=null?e:this.terrainExaggeration)}setStyle(t,e){return super.setStyle(R(t),e)}setLanguage(t=d.primaryLanguage){if(t===f.AUTO)return this.setLanguage(T());this.setPrimaryLanguage(t)}setPrimaryLanguage(t=d.primaryLanguage){!E(t)||this.onStyleReady(()=>{if(t===f.AUTO)return this.setPrimaryLanguage(T());g.primaryLanguage=t;const e=this.getStyle().layers,a=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,h=/^\s*name\s*(:\s*(\S*))?\s*$/,c=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/,i=/^(.*)({\s*name\s*(:\s*(\S*))?\s*})(.*)$/,o=t?`name:${t}`:"name",s=["case",["has",o],["get",o],["get","name:latin"]];for(let m=0;m<e.length;m+=1){const u=e[m],y=u.layout;if(!y||!y["text-field"])continue;const n=this.getLayoutProperty(u.id,"text-field");let p;if(Array.isArray(n)&&n.length>=2&&n[0].trim().toLowerCase()==="concat"){const l=n.slice();for(let L=0;L<n.length;L+=1){const _=n[L];if((typeof _=="string"||_ instanceof String)&&a.exec(_.toString())){l[L]=s;break}else if(Array.isArray(_)&&_.length>=2&&_[0].trim().toLowerCase()==="get"&&h.exec(_[1].toString())){l[L]=s;break}else if(Array.isArray(_)&&_.length===4&&_[0].trim().toLowerCase()==="case"){l[L]=s;break}}this.setLayoutProperty(u.id,"text-field",l)}else if(Array.isArray(n)&&n.length>=2&&n[0].trim().toLowerCase()==="get"&&h.exec(n[1].toString())){const l=s;this.setLayoutProperty(u.id,"text-field",l)}else if((typeof n=="string"||n instanceof String)&&a.exec(n.toString())){const l=s;this.setLayoutProperty(u.id,"text-field",l)}else if(Array.isArray(n)&&n.length===4&&n[0].trim().toLowerCase()==="case"){const l=s;this.setLayoutProperty(u.id,"text-field",l)}else if((typeof n=="string"||n instanceof String)&&(p=c.exec(n.toString()))!==null){const l=`{${o}}${p[3]}{name${p[4]||""}}`;this.setLayoutProperty(u.id,"text-field",l)}else if((typeof n=="string"||n instanceof String)&&(p=i.exec(n.toString()))!==null){const l=`${p[1]}{${o}}${p[5]}`;this.setLayoutProperty(u.id,"text-field",l)}}})}setSecondaryLanguage(t=d.secondaryLanguage){!E(t)||this.onStyleReady(()=>{if(t===f.AUTO)return this.setSecondaryLanguage(T());g.secondaryLanguage=t;const e=this.getStyle().layers,a=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,h=/^\s*name\s*(:\s*(\S*))?\s*$/,c=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/;let i;for(let o=0;o<e.length;o+=1){const s=e[o],m=s.layout;if(!m||!m["text-field"])continue;const u=this.getLayoutProperty(s.id,"text-field");let y;if(Array.isArray(u)&&u.length>=2&&u[0].trim().toLowerCase()==="concat"){y=u.slice();let n=0;for(let p=0;p<u.length;p+=1){const l=u[p];if((typeof l=="string"||l instanceof String)&&a.exec(l.toString())){if(n===1){y[p]=`{name:${t}}`;break}n+=1}else if(Array.isArray(l)&&l.length>=2&&l[0].trim().toLowerCase()==="get"&&h.exec(l[1].toString())){if(n===1){y[p][1]=`name:${t}`;break}n+=1}else if(Array.isArray(l)&&l.length===4&&l[0].trim().toLowerCase()==="case"){if(n===1){y[p]=["get",`name:${t}`];break}n+=1}}this.setLayoutProperty(s.id,"text-field",y)}else if((typeof u=="string"||u instanceof String)&&(i=c.exec(u.toString()))!==null){const n=t?`name:${t}`:"name";y=`{name${i[1]||""}}${i[3]}{${n}}`,this.setLayoutProperty(s.id,"text-field",y)}}})}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}enableTerrain(t=this.terrainExaggeration){if(t<0){console.warn("Terrain exaggeration cannot be negative.");return}const e=this.getTerrain(),a=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=t,this.addSource(d.terrainSourceId,{type:"raster-dem",url:d.terrainSourceURL}),this.setTerrain({source:d.terrainSourceId,exaggeration:t})};if(e){this.setTerrain(B(M({},e),{exaggeration:t}));return}this.loaded()||this.isTerrainEnabled?a():this.once("load",()=>{this.getTerrain()&&this.getSource(d.terrainSourceId)||a()})}disableTerrain(){this.isTerrainEnabled=!1,this.setTerrain(null),this.getSource(d.terrainSourceId)&&this.removeSource(d.terrainSourceId)}setTerrainExaggeration(t){this.enableTerrain(t)}onStyleReady(t){this.isStyleLoaded()?t():this.once("styledata",()=>{t()})}fitToIpBounds(){return C(this,null,function*(){const t=yield v.info();this.fitBounds(t.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(t){return C(this,null,function*(){const e=yield v.info();this.jumpTo({center:[e.longitude,e.latitude],zoom:t||11})})}getCameraHash(){const t=new Float32Array(5),e=this.getCenter();return t[0]=e.lng,t[1]=e.lat,t[2]=this.getZoom(),t[3]=this.getPitch(),t[4]=this.getBearing(),G.fromUint8Array(new Uint8Array(t.buffer))}}class x{constructor(t,e){this.x=t,this.y=e}_matMult(t){const e=t[0]*this.x+t[1]*this.y,a=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=a,this}_add(t){return this.x+=t.x,this.y+=t.y,this}_sub(t){return this.x-=t.x,this.y-=t.y,this}_mult(t){return this.x*=t,this.y*=t,this}_div(t){return this.x/=t,this.y/=t,this}_multByPoint(t){return this.x*=t.x,this.y*=t.y,this}_divByPoint(t){return this.x/=t.x,this.y/=t.y,this}_unit(){return this._div(this.mag()),this}_perp(){const t=this.y;return this.y=this.x,this.x=-t,this}_rotate(t){const e=Math.cos(t),a=Math.sin(t),h=e*this.x-a*this.y,c=a*this.x+e*this.y;return this.x=h,this.y=c,this}_rotateAround(t,e){const a=Math.cos(t),h=Math.sin(t),c=e.x+a*(this.x-e.x)-h*(this.y-e.y),i=e.y+h*(this.x-e.x)+a*(this.y-e.y);return this.x=c,this.y=i,this}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}clone(){return new x(this.x,this.y)}add(t){return this.clone()._add(t)}sub(t){return this.clone()._sub(t)}multByPoint(t){return this.clone()._multByPoint(t)}divByPoint(t){return this.clone()._divByPoint(t)}mult(t){return this.clone()._mult(t)}div(t){return this.clone()._div(t)}rotate(t){return this.clone()._rotate(t)}rotateAround(t,e){return this.clone()._rotateAround(t,e)}matMult(t){return this.clone()._matMult(t)}unit(){return this.clone()._unit()}perp(){return this.clone()._perp()}round(){return this.clone()._round()}mag(){return Math.sqrt(this.x*this.x+this.y*this.y)}equals(t){return this.x===t.x&&this.y===t.y}dist(t){return Math.sqrt(this.distSqr(t))}distSqr(t){const e=t.x-this.x,a=t.y-this.y;return e*e+a*a}angle(){return Math.atan2(this.y,this.x)}angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)}angleWith(t){return this.angleWithSep(t.x,t.y)}angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)}static convert(t){return t instanceof x?t:Array.isArray(t)?new x(t[0],t[1]):t}}const{supported:pt,setRTLTextPlugin:mt,getRTLTextPluginStatus:yt,NavigationControl:_t,GeolocateControl:ft,AttributionControl:St,LogoControl:At,ScaleControl:Lt,FullscreenControl:Ct,TerrainControl:xt,Popup:bt,Marker:Tt,Style:It,LngLat:vt,LngLatBounds:Et,MercatorCoordinate:Nt,Evented:wt,AJAXError:Rt,CanvasSource:Pt,GeoJSONSource:Ut,ImageSource:Ot,RasterDEMTileSource:kt,RasterTileSource:Mt,VectorTileSource:Bt,VideoSource:$t,prewarm:Ht,clearPrewarmedResources:jt,version:Gt,workerCount:Kt,maxParallelImageRequests:Dt,clearStorage:zt,workerUrl:Ft,addProtocol:Vt,removeProtocol:Zt}=S;export{Rt as AJAXError,St as AttributionControl,Pt as CanvasSource,wt as Evented,Ct as FullscreenControl,Ut as GeoJSONSource,ft as GeolocateControl,$ as GeolocationType,Ot as ImageSource,f as Language,re as LanguageGeocoding,vt as LngLat,Et as LngLatBounds,At as LogoControl,dt as Map,ie as MapStyle,ae as MapStyleVariant,Tt as Marker,Nt as MercatorCoordinate,_t as NavigationControl,x as Point,bt as Popup,kt as RasterDEMTileSource,Mt as RasterTileSource,oe as ReferenceMapStyle,Lt as ScaleControl,N as SdkConfig,ne as ServiceError,It as Style,xt as TerrainControl,Bt as VectorTileSource,$t as VideoSource,Vt as addProtocol,jt as clearPrewarmedResources,zt as clearStorage,g as config,se as coordinates,le as data,ce as geocoding,he as geolocation,yt as getRTLTextPluginStatus,Dt as maxParallelImageRequests,Ht as prewarm,Zt as removeProtocol,mt as setRTLTextPlugin,ue as staticMaps,pt as supported,Gt as version,Kt as workerCount,Ft as workerUrl};
|