@maptiler/client 1.8.0 → 2.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.
@@ -101,78 +101,417 @@ declare class ClientConfig {
101
101
  */
102
102
  declare const config: ClientConfig;
103
103
 
104
+ type LanguageInfo = {
105
+ /**
106
+ * Two letter ISO code, such as `"en"` for English language.
107
+ * Can be `null` if the language is a flag to be evaluated at runtime,
108
+ * as it is the case for some "modes".
109
+ */
110
+ code: string | null;
111
+ /**
112
+ * The full OSM language flag, such as `"name:en"` for the English language.
113
+ * Can also be a non-OSM flag if the language needs to be evaluated at runtime, such as `"auto"`,
114
+ * as it is the case for some "modes".
115
+ */
116
+ flag: string;
117
+ /**
118
+ * English name of the language.
119
+ */
120
+ name: string;
121
+ /**
122
+ * Whether the language leverages only the latin charsets.
123
+ */
124
+ latin: boolean;
125
+ /**
126
+ * Some language descriptions corresponds to "modes" rather than to actual languages.
127
+ * For instance the "visitor" mode consists in displaying bylingual labels.
128
+ */
129
+ isMode: boolean;
130
+ /**
131
+ * Whether the language is compatible with the geocoding API
132
+ */
133
+ geocoding: boolean;
134
+ };
104
135
  /**
105
- * Languages. Note that not all the languages of this list are available but the compatibility list may be expanded in the future.
106
- */
107
- declare const LanguageGeocoding: {
108
- AUTO: string;
109
- ALBANIAN: string;
110
- ARABIC: string;
111
- ARMENIAN: string;
112
- AZERBAIJANI: string;
113
- BELORUSSIAN: string;
114
- BOSNIAN: string;
115
- BRETON: string;
116
- BULGARIAN: string;
117
- CATALAN: string;
118
- CHINESE: string;
119
- CROATIAN: string;
120
- CZECH: string;
121
- DANISH: string;
122
- DUTCH: string;
123
- ENGLISH: string;
124
- ESPERANTO: string;
125
- ESTONIAN: string;
126
- FINNISH: string;
127
- FRENCH: string;
128
- FRISIAN: string;
129
- GEORGIAN: string;
130
- GERMAN: string;
131
- GREEK: string;
132
- HEBREW: string;
133
- HUNGARIAN: string;
134
- ICELANDIC: string;
135
- IRISH: string;
136
- ITALIAN: string;
137
- JAPANESE: string;
138
- KANNADA: string;
139
- KAZAKH: string;
140
- KOREAN: string;
141
- ROMAN_LATIN: string;
142
- LATVIAN: string;
143
- LITHUANIAN: string;
144
- LUXEMBOURGISH: string;
145
- MACEDONIAN: string;
146
- MALTESE: string;
147
- NORWEGIAN: string;
148
- POLISH: string;
149
- PORTUGUESE: string;
150
- ROMANIAN: string;
151
- ROMANSH: string;
152
- RUSSIAN: string;
153
- SCOTTISH_GAELIC: string;
154
- SERBIAN_CYRILLIC: string;
155
- SLOVAK: string;
156
- SLOVENE: string;
157
- SPANISH: string;
158
- SWEDISH: string;
159
- THAI: string;
160
- TURKISH: string;
161
- UKRAINIAN: string;
162
- WELSH: string;
136
+ * The complete list of languages
137
+ */
138
+ declare const Language: {
139
+ /**
140
+ * Language mode to display the labels in the end user's device language.
141
+ */
142
+ readonly AUTO: LanguageInfo;
143
+ /**
144
+ * The OSM language using latin script. MapTiler discourages its use as a primary language setting due to the lack of actual linguistic specificity,
145
+ * though it can be an handy fallback. This is not to be confused with the "Classical Latin" language, which is available under the tag `.CLASSICAL_LATIN`.
146
+ */
147
+ readonly LATIN: LanguageInfo;
148
+ /**
149
+ * The OSM language using non-latin script. MapTiler discourages its use as a primary language setting due to the lack of actual linguistic specificity,
150
+ * though it can be an handy fallback.
151
+ */
152
+ readonly NON_LATIN: LanguageInfo;
153
+ /**
154
+ * Using the local language generaly (but not always) means that every labels of a given region will use the dominant local language.
155
+ */
156
+ readonly LOCAL: LanguageInfo;
157
+ /**
158
+ * Amharic language
159
+ */
160
+ readonly AMHARIC: LanguageInfo;
161
+ /**
162
+ * Arabic language (right-to-left script)
163
+ */
164
+ readonly ARABIC: LanguageInfo;
165
+ /**
166
+ * Azerbaijani language
167
+ */
168
+ readonly AZERBAIJANI: LanguageInfo;
169
+ /**
170
+ * Belarusian langauge
171
+ */
172
+ readonly BELARUSIAN: LanguageInfo;
173
+ /**
174
+ * Bulgarian language
175
+ */
176
+ readonly BULGARIAN: LanguageInfo;
177
+ /**
178
+ * Bengali language
179
+ */
180
+ readonly BENGALI: LanguageInfo;
181
+ /**
182
+ * Breton language
183
+ */
184
+ readonly BRETON: LanguageInfo;
185
+ /**
186
+ * Bosnian language
187
+ */
188
+ readonly BOSNIAN: LanguageInfo;
189
+ /**
190
+ * Catalan language
191
+ */
192
+ readonly CATALAN: LanguageInfo;
193
+ /**
194
+ * Chinese language
195
+ */
196
+ readonly CHINESE: LanguageInfo;
197
+ /**
198
+ * Traditional Chinese language
199
+ */
200
+ readonly TRADITIONAL_CHINESE: LanguageInfo;
201
+ /**
202
+ * Simplified Chinese language
203
+ */
204
+ readonly SIMPLIFIED_CHINESE: LanguageInfo;
205
+ /**
206
+ * Corsican language
207
+ */
208
+ readonly CORSICAN: LanguageInfo;
209
+ /**
210
+ * Czech language
211
+ */
212
+ readonly CZECH: LanguageInfo;
213
+ /**
214
+ * Welsh language
215
+ */
216
+ readonly WELSH: LanguageInfo;
217
+ /**
218
+ * Danish language
219
+ */
220
+ readonly DANISH: LanguageInfo;
221
+ /**
222
+ * German language
223
+ */
224
+ readonly GERMAN: LanguageInfo;
225
+ /**
226
+ * Greek language
227
+ */
228
+ readonly GREEK: LanguageInfo;
229
+ /**
230
+ * English language
231
+ */
232
+ readonly ENGLISH: LanguageInfo;
233
+ /**
234
+ * Esperanto language
235
+ */
236
+ readonly ESPERANTO: LanguageInfo;
237
+ /**
238
+ * Spanish language
239
+ */
240
+ readonly SPANISH: LanguageInfo;
241
+ /**
242
+ * Estonian language
243
+ */
244
+ readonly ESTONIAN: LanguageInfo;
245
+ /**
246
+ * Basque language
247
+ */
248
+ readonly BASQUE: LanguageInfo;
249
+ /**
250
+ * Finnish language
251
+ */
252
+ readonly FINNISH: LanguageInfo;
253
+ /**
254
+ * French language
255
+ */
256
+ readonly FRENCH: LanguageInfo;
257
+ /**
258
+ * Frisian language
259
+ */
260
+ readonly FRISIAN: LanguageInfo;
261
+ /**
262
+ * Irish language
263
+ */
264
+ readonly IRISH: LanguageInfo;
265
+ /**
266
+ * Scottish Gaelic language
267
+ */
268
+ readonly SCOTTISH_GAELIC: LanguageInfo;
269
+ /**
270
+ * Hebrew language (right-to-left non-latin script)
271
+ */
272
+ readonly HEBREW: LanguageInfo;
273
+ /**
274
+ * Hindi language
275
+ */
276
+ readonly HINDI: LanguageInfo;
277
+ /**
278
+ * Croatian language
279
+ */
280
+ readonly CROATIAN: LanguageInfo;
281
+ /**
282
+ * Hungarian language
283
+ */
284
+ readonly HUNGARIAN: LanguageInfo;
285
+ /**
286
+ * Armenian language
287
+ */
288
+ readonly ARMENIAN: LanguageInfo;
289
+ /**
290
+ * Indonesian language
291
+ */
292
+ readonly INDONESIAN: LanguageInfo;
293
+ /**
294
+ * Icelandic language
295
+ */
296
+ readonly ICELANDIC: LanguageInfo;
297
+ /**
298
+ * Italian language
299
+ */
300
+ readonly ITALIAN: LanguageInfo;
301
+ /**
302
+ * Japanese language
303
+ */
304
+ readonly JAPANESE: LanguageInfo;
305
+ /**
306
+ * Japanese language in Hiragana form
307
+ */
308
+ readonly JAPANESE_HIRAGANA: LanguageInfo;
309
+ /**
310
+ * Japanese language (latin script)
311
+ */
312
+ readonly JAPANESE_2018: LanguageInfo;
313
+ /**
314
+ * Japanese language in Kana form (non-latin script)
315
+ */
316
+ readonly JAPANESE_KANA: LanguageInfo;
317
+ /**
318
+ * Japanse language, romanized (latin script)
319
+ */
320
+ readonly JAPANESE_LATIN: LanguageInfo;
321
+ /**
322
+ * Georgian language
323
+ */
324
+ readonly GEORGIAN: LanguageInfo;
325
+ /**
326
+ * Kazakh language
327
+ */
328
+ readonly KAZAKH: LanguageInfo;
329
+ /**
330
+ * Kannada language
331
+ */
332
+ readonly KANNADA: LanguageInfo;
333
+ /**
334
+ * Korean language
335
+ */
336
+ readonly KOREAN: LanguageInfo;
337
+ /**
338
+ * Korean language (latin script)
339
+ */
340
+ readonly KOREAN_LATIN: LanguageInfo;
341
+ /**
342
+ * Kurdish language
343
+ */
344
+ readonly KURDISH: LanguageInfo;
345
+ /**
346
+ * Classical Latin language
347
+ */
348
+ readonly CLASSICAL_LATIN: LanguageInfo;
349
+ /**
350
+ * Luxembourgish language
351
+ */
352
+ readonly LUXEMBOURGISH: LanguageInfo;
353
+ /**
354
+ * Lithuanian language
355
+ */
356
+ readonly LITHUANIAN: LanguageInfo;
357
+ /**
358
+ * Latvian language
359
+ */
360
+ readonly LATVIAN: LanguageInfo;
361
+ /**
362
+ * Macedonian language
363
+ */
364
+ readonly MACEDONIAN: LanguageInfo;
365
+ /**
366
+ * Malayalm language
367
+ */
368
+ readonly MALAYALAM: LanguageInfo;
369
+ /**
370
+ * Maltese language
371
+ */
372
+ readonly MALTESE: LanguageInfo;
373
+ /**
374
+ * Dutch language
375
+ */
376
+ readonly DUTCH: LanguageInfo;
377
+ /**
378
+ * Norwegian language
379
+ */
380
+ readonly NORWEGIAN: LanguageInfo;
381
+ /**
382
+ * Occitan language
383
+ */
384
+ readonly OCCITAN: LanguageInfo;
385
+ /**
386
+ * Polish language
387
+ */
388
+ readonly POLISH: LanguageInfo;
389
+ /**
390
+ * Persian language
391
+ */
392
+ readonly PERSIAN: LanguageInfo;
393
+ /**
394
+ * Punjabi language
395
+ */
396
+ readonly PUNJABI: LanguageInfo;
397
+ /**
398
+ * Western Punjabi language
399
+ */
400
+ readonly WESTERN_PUNJABI: LanguageInfo;
401
+ /**
402
+ * Portuguese language
403
+ */
404
+ readonly PORTUGUESE: LanguageInfo;
405
+ /**
406
+ * Romansh language
407
+ */
408
+ readonly ROMANSH: LanguageInfo;
409
+ /**
410
+ * Romanian language
411
+ */
412
+ readonly ROMANIAN: LanguageInfo;
413
+ /**
414
+ * Russian language
415
+ */
416
+ readonly RUSSIAN: LanguageInfo;
417
+ /**
418
+ * Slovak language
419
+ */
420
+ readonly SLOVAK: LanguageInfo;
421
+ /**
422
+ * Slovene language
423
+ */
424
+ readonly SLOVENE: LanguageInfo;
425
+ /**
426
+ * Albanian language
427
+ */
428
+ readonly ALBANIAN: LanguageInfo;
429
+ /**
430
+ * Serbian language (cyrillic script)
431
+ */
432
+ readonly SERBIAN_CYRILLIC: LanguageInfo;
433
+ /**
434
+ * Serbian language (latin script)
435
+ */
436
+ readonly SERBIAN_LATIN: LanguageInfo;
437
+ /**
438
+ * Swedish language
439
+ */
440
+ readonly SWEDISH: LanguageInfo;
441
+ /**
442
+ * Tamil language
443
+ */
444
+ readonly TAMIL: LanguageInfo;
445
+ /**
446
+ * Telugu language
447
+ */
448
+ readonly TELUGU: LanguageInfo;
449
+ /**
450
+ * Thai language
451
+ */
452
+ readonly THAI: LanguageInfo;
453
+ /**
454
+ * Turkish language
455
+ */
456
+ readonly TURKISH: LanguageInfo;
457
+ /**
458
+ * Ukrainian language
459
+ */
460
+ readonly UKRAINIAN: LanguageInfo;
461
+ /**
462
+ * Vietnamese language (latin script)
463
+ */
464
+ readonly VIETNAMESE: LanguageInfo;
163
465
  };
164
- type Values<T> = T[keyof T];
165
466
  /**
166
- * Built-in languages values as strings
467
+ * Get language infos from a provided language key, the key being the no-whitespace capital name.
468
+ * By default, the language dictionnary to look into is the one defined in this library, but another one could be provided
469
+ * Returns `null` if not found.
470
+ */
471
+ declare function getLanguageInfoFromKey(languageKey: string, languageDictionnary?: {
472
+ [k: string]: LanguageInfo;
473
+ }): LanguageInfo | null;
474
+ /**
475
+ * Get the language info from a provided 2-character iso code.
476
+ * By default, the language dictionnary to look into is the one defined in this library, but another one could be provided
477
+ * Returns `null` if not found.
478
+ */
479
+ declare function getLanguageInfoFromCode(languageCode: string, languageDictionnary?: {
480
+ [k: string]: LanguageInfo;
481
+ }): LanguageInfo | null;
482
+ /**
483
+ * Get the language info from a language flag (eg. `"name:en"`).
484
+ * This is also handy to check is a given language flag is a supported language.
485
+ * By default, the language dictionnary to look into is the one defined in this library, but another one could be provided
486
+ * Returns `null` if not found.
487
+ */
488
+ declare function getLanguageInfoFromFlag(languageFlag: string, languageDictionnary?: {
489
+ [k: string]: LanguageInfo;
490
+ }): LanguageInfo | null;
491
+ /**
492
+ * Get the default language of the device, as a LanguageInfo object.
493
+ */
494
+ declare function getAutoLanguage(): LanguageInfo;
495
+ declare function isLanguageInfo(obj: unknown): obj is LanguageInfo;
496
+ /**
497
+ * By default, the language dictionnary to look into is the one defined in this library, but another one could be provided
498
+ */
499
+ declare function toLanguageInfo(lang: LanguageInfo | string, languageDictionnary?: {
500
+ [k: string]: LanguageInfo;
501
+ }): LanguageInfo | null;
502
+ /**
503
+ * Tells if two languages are the same, even though possibly provided under different forms.
504
+ * Note: this is not comparing object references, but values.
167
505
  */
168
- type LanguageGeocodingString = Values<typeof LanguageGeocoding>;
169
- declare function getAutoLanguageGeocoding(): LanguageGeocodingString;
506
+ declare function areSameLanguages(langA: string | LanguageInfo, langB: string | LanguageInfo, languageDictionnary?: {
507
+ [k: string]: LanguageInfo;
508
+ }): boolean;
170
509
 
171
510
  type LanguageGeocodingOptions = {
172
511
  /**
173
512
  * Prefer results in specific language. It’s possible to specify multiple values.
174
513
  */
175
- language?: LanguageGeocodingString | Array<LanguageGeocodingString>;
514
+ language?: string | Array<string> | LanguageInfo | Array<LanguageInfo>;
176
515
  };
177
516
  type CommonForwardAndReverseGeocodingOptions = LanguageGeocodingOptions & {
178
517
  /**
@@ -187,7 +526,7 @@ type CommonForwardAndReverseGeocodingOptions = LanguageGeocodingOptions & {
187
526
  * Filter of feature types to return.
188
527
  * If not specified, feature of all available types except `poi` are returned (`types = ["poi"]`, `excludeTypes = true`).
189
528
  */
190
- types?: ("country" | "region" | "subregion" | "county" | "joint_municipality" | "joint_submunicipality" | "municipality" | "municipal_district" | "locality" | "neighbourhood" | "place" | "postal_code" | "address" | "poi")[];
529
+ types?: ("country" | "region" | "subregion" | "county" | "joint_municipality" | "joint_submunicipality" | "municipality" | "municipal_district" | "locality" | "neighbourhood" | "place" | "postal_code" | "address" | "road" | "poi")[];
191
530
  /**
192
531
  * Set to `true` to use all available feature types except those mentioned in `types`. Default value is `false` if `types` is specified.
193
532
  */
@@ -316,6 +655,16 @@ type GeocodingFeature = Feature<Geometry, FeatureProperties> & FeatureBase & {
316
655
  * You can use the relevance property to remove results that don't fully match the query.
317
656
  */
318
657
  relevance: number;
658
+ /**
659
+ * A string analogous to the `text` field that more closely matches the query than results in the specified language.
660
+ * For example, querying _Praha, Czechia_ with language set to English (`en`) might return a feature with the `text` _Prague_ and the `matching_text` _Praha_.
661
+ */
662
+ matching_text?: string;
663
+ /**
664
+ * A string analogous to the `place_name` field that more closely matches the query than results in the specified language.
665
+ * For example, querying _Praha, Czechia_ with language set to English (`en`) might return a feature with the `place_name` _Prague, Czechia_ and a `matching_place_name` of _Praha, Czechia_.
666
+ */
667
+ matching_place_name?: string;
319
668
  };
320
669
  type GeocodingSearchResult = {
321
670
  type: "FeatureCollection";
@@ -380,63 +729,6 @@ declare const geocoding: {
380
729
  reverse: typeof reverse;
381
730
  byId: typeof byId;
382
731
  batch: typeof batch$1;
383
- language: {
384
- AUTO: string;
385
- ALBANIAN: string;
386
- ARABIC: string;
387
- ARMENIAN: string;
388
- AZERBAIJANI: string;
389
- BELORUSSIAN: string;
390
- BOSNIAN: string;
391
- BRETON: string;
392
- BULGARIAN: string;
393
- CATALAN: string;
394
- CHINESE: string;
395
- CROATIAN: string;
396
- CZECH: string;
397
- DANISH: string;
398
- DUTCH: string;
399
- ENGLISH: string;
400
- ESPERANTO: string;
401
- ESTONIAN: string;
402
- FINNISH: string;
403
- FRENCH: string;
404
- FRISIAN: string;
405
- GEORGIAN: string;
406
- GERMAN: string;
407
- GREEK: string;
408
- HEBREW: string;
409
- HUNGARIAN: string;
410
- ICELANDIC: string;
411
- IRISH: string;
412
- ITALIAN: string;
413
- JAPANESE: string;
414
- KANNADA: string;
415
- KAZAKH: string;
416
- KOREAN: string;
417
- ROMAN_LATIN: string;
418
- LATVIAN: string;
419
- LITHUANIAN: string;
420
- LUXEMBOURGISH: string;
421
- MACEDONIAN: string;
422
- MALTESE: string;
423
- NORWEGIAN: string;
424
- POLISH: string;
425
- PORTUGUESE: string;
426
- ROMANIAN: string;
427
- ROMANSH: string;
428
- RUSSIAN: string;
429
- SCOTTISH_GAELIC: string;
430
- SERBIAN_CYRILLIC: string;
431
- SLOVAK: string;
432
- SLOVENE: string;
433
- SPANISH: string;
434
- SWEDISH: string;
435
- THAI: string;
436
- TURKISH: string;
437
- UKRAINIAN: string;
438
- WELSH: string;
439
- };
440
732
  };
441
733
 
442
734
  /**
@@ -1504,4 +1796,4 @@ declare const misc: {
1504
1796
  simplify: typeof simplify;
1505
1797
  };
1506
1798
 
1507
- export { type AutomaticStaticMapOptions, type BoundedStaticMapOptions, type BufferToPixelDataFunction, type ByIdGeocodingOptions, type CenteredStaticMapOptions, ClientConfig, type CommonForwardAndReverseGeocodingOptions, type CoordinateExport, type CoordinateGrid, type CoordinateId, type CoordinateSearch, type CoordinateSearchResult, type CoordinateTransformResult, type CoordinateTransformation, type Coordinates, type CoordinatesSearchOptions, type CoordinatesTransformOptions, type DefaultTransformation, type ElevationAtOptions, type ElevationBatchOptions, type FeatureHierarchy, type FetchFunction, type GeocodingFeature, type GeocodingOptions, type GeocodingSearchResult, type GeolocationInfoOptions, type GeolocationResult, type GetDataOptions, LanguageGeocoding, type LanguageGeocodingOptions, type LanguageGeocodingString, MapStyle, type MapStylePreset, type MapStyleType, MapStyleVariant, type PixelData, ReferenceMapStyle, type ReverseGeocodingOptions, ServiceError, type StaticMapBaseOptions, type StaticMapMarker, type TileJSON, type XYZ, bufferToPixelDataBrowser, circumferenceAtLatitude, config, coordinates, data, elevation, expandMapStyle, geocoding, geolocation, getAutoLanguageGeocoding, getBufferToPixelDataParser, getTileCache, mapStylePresetList, math, misc, staticMaps, styleToStyle };
1799
+ export { type AutomaticStaticMapOptions, type BoundedStaticMapOptions, type BufferToPixelDataFunction, type ByIdGeocodingOptions, type CenteredStaticMapOptions, ClientConfig, type CommonForwardAndReverseGeocodingOptions, type CoordinateExport, type CoordinateGrid, type CoordinateId, type CoordinateSearch, type CoordinateSearchResult, type CoordinateTransformResult, type CoordinateTransformation, type Coordinates, type CoordinatesSearchOptions, type CoordinatesTransformOptions, type DefaultTransformation, type ElevationAtOptions, type ElevationBatchOptions, type FeatureHierarchy, type FetchFunction, type GeocodingFeature, type GeocodingOptions, type GeocodingSearchResult, type GeolocationInfoOptions, type GeolocationResult, type GetDataOptions, Language, type LanguageGeocodingOptions, type LanguageInfo, MapStyle, type MapStylePreset, type MapStyleType, MapStyleVariant, type PixelData, ReferenceMapStyle, type ReverseGeocodingOptions, ServiceError, type StaticMapBaseOptions, type StaticMapMarker, type TileJSON, type XYZ, areSameLanguages, bufferToPixelDataBrowser, circumferenceAtLatitude, config, coordinates, data, elevation, expandMapStyle, geocoding, geolocation, getAutoLanguage, getBufferToPixelDataParser, getLanguageInfoFromCode, getLanguageInfoFromFlag, getLanguageInfoFromKey, getTileCache, isLanguageInfo, mapStylePresetList, math, misc, staticMaps, styleToStyle, toLanguageInfo };