@maptiler/client 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/.eslintrc.cjs +6 -0
- package/LICENSE +29 -0
- package/dist/maptiler-client.cjs +692 -0
- package/dist/maptiler-client.cjs.map +1 -0
- package/dist/maptiler-client.d.ts +702 -0
- package/dist/maptiler-client.min.mjs +1 -0
- package/dist/maptiler-client.mjs +680 -0
- package/dist/maptiler-client.mjs.map +1 -0
- package/dist/maptiler-client.umd.js +698 -0
- package/dist/maptiler-client.umd.js.map +1 -0
- package/dist/maptiler-client.umd.min.js +1 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +85 -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/ClientConfig.html +122 -0
- package/docs/classes/ServiceError.html +93 -0
- package/docs/images/JS-logo.svg +4 -0
- package/docs/images/TS-logo.svg +6 -0
- package/docs/images/maptiler-client-logo.afdesign +0 -0
- package/docs/images/maptiler-client-logo.svg +75 -0
- package/docs/images/maptiler-logo.svg +23 -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/index.html +280 -0
- package/docs/modules.html +119 -0
- package/docs/types/AutomaticStaticMapOptions.html +80 -0
- package/docs/types/BoundedStaticMapOptions.html +80 -0
- package/docs/types/CenteredStaticMapOptions.html +80 -0
- package/docs/types/CoordinateExport.html +85 -0
- package/docs/types/CoordinateGrid.html +83 -0
- package/docs/types/CoordinateId.html +85 -0
- package/docs/types/CoordinateSearch.html +107 -0
- package/docs/types/CoordinateSearchResult.html +89 -0
- package/docs/types/CoordinateTransformResult.html +90 -0
- package/docs/types/CoordinateTransformation.html +103 -0
- package/docs/types/Coordinates.html +78 -0
- package/docs/types/CoordinatesSearchOptions.html +97 -0
- package/docs/types/CoordinatesTransformOptions.html +99 -0
- package/docs/types/FeatureHierarchy.html +89 -0
- package/docs/types/FetchFunction.html +93 -0
- package/docs/types/GeocodingFeature.html +78 -0
- package/docs/types/GeocodingOptions.html +97 -0
- package/docs/types/GeocodingSearchResult.html +95 -0
- package/docs/types/GeolocationInfoOptions.html +87 -0
- package/docs/types/GeolocationResult.html +150 -0
- package/docs/types/GetDataOptions.html +87 -0
- package/docs/types/LanguageGeocodingString.html +80 -0
- package/docs/types/ReverseGeocodingOptions.html +89 -0
- package/docs/types/StaticMapBaseOptions.html +176 -0
- package/docs/types/StaticMapMarker.html +80 -0
- package/docs/types/XYZ.html +87 -0
- package/docs/variables/LanguageGeocoding.html +193 -0
- package/docs/variables/config.html +80 -0
- package/docs/variables/coordinates-1.html +124 -0
- package/docs/variables/data.html +103 -0
- package/docs/variables/geocoding.html +239 -0
- package/docs/variables/geolocation.html +101 -0
- package/docs/variables/staticMaps.html +147 -0
- package/docsmd/.nojekyll +1 -0
- package/docsmd/README.md +756 -0
- package/docsmd/classes/ClientConfig.md +90 -0
- package/docsmd/classes/ServiceError.md +52 -0
- package/docsmd/images/JS-logo.svg +4 -0
- package/docsmd/images/TS-logo.svg +6 -0
- package/docsmd/images/maptiler-client-logo.afdesign +0 -0
- package/docsmd/images/maptiler-client-logo.svg +75 -0
- package/docsmd/images/maptiler-logo.svg +23 -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/examples/test-browser-es.html +102 -0
- package/examples/test-browser-umd.html +89 -0
- package/examples/test-node.js +52 -0
- package/images/JS-logo.svg +4 -0
- package/images/TS-logo.svg +6 -0
- package/images/maptiler-client-logo.afdesign +0 -0
- package/images/maptiler-client-logo.svg +75 -0
- package/images/maptiler-logo.svg +23 -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/package.json +69 -0
- package/readme.md +287 -0
- package/rollup.config.js +142 -0
- package/src/callFetch.ts +18 -0
- package/src/config.ts +65 -0
- package/src/defaults.ts +11 -0
- package/src/index.ts +90 -0
- package/src/language.ts +87 -0
- package/src/services/ServiceError.ts +10 -0
- package/src/services/coordinates.ts +258 -0
- package/src/services/data.ts +63 -0
- package/src/services/geocoding.ts +239 -0
- package/src/services/geolocation.ts +139 -0
- package/src/services/simplify.ts +87 -0
- package/src/services/staticMaps.ts +462 -0
- package/tsconfig.json +10 -0
- package/typedoc.json +10 -0
|
@@ -0,0 +1,702 @@
|
|
|
1
|
+
import { BBox, Position, Feature, FeatureCollection } from 'geojson';
|
|
2
|
+
export { BBox, Position } from 'geojson';
|
|
3
|
+
|
|
4
|
+
type FetchFunction = (url: string, options: object) => Promise<any>;
|
|
5
|
+
/**
|
|
6
|
+
* The configuration object definition
|
|
7
|
+
*/
|
|
8
|
+
declare class ClientConfig {
|
|
9
|
+
/**
|
|
10
|
+
* MapTiler Cloud API key
|
|
11
|
+
*/
|
|
12
|
+
private _apiKey;
|
|
13
|
+
/**
|
|
14
|
+
* The fetch function. To be set if in Node < 18, otherwise
|
|
15
|
+
* will be automatically resolved.
|
|
16
|
+
*/
|
|
17
|
+
private _fetch;
|
|
18
|
+
/**
|
|
19
|
+
* Set the MapTiler Cloud API key
|
|
20
|
+
*/
|
|
21
|
+
set apiKey(k: string);
|
|
22
|
+
/**
|
|
23
|
+
* Get the MapTiler Cloud API key
|
|
24
|
+
*/
|
|
25
|
+
get apiKey(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Set a the custom fetch function to replace the default one
|
|
28
|
+
*/
|
|
29
|
+
set fetch(f: FetchFunction);
|
|
30
|
+
/**
|
|
31
|
+
* Get the fetch fucntion
|
|
32
|
+
*/
|
|
33
|
+
get fetch(): FetchFunction | null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Configuration object
|
|
37
|
+
*/
|
|
38
|
+
declare const config: ClientConfig;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Languages. Note that not all the languages of this list are available but the compatibility list may be expanded in the future.
|
|
42
|
+
*/
|
|
43
|
+
declare const LanguageGeocoding: {
|
|
44
|
+
AUTO: string;
|
|
45
|
+
ALBANIAN: string;
|
|
46
|
+
ARABIC: string;
|
|
47
|
+
ARMENIAN: string;
|
|
48
|
+
AZERBAIJANI: string;
|
|
49
|
+
BELORUSSIAN: string;
|
|
50
|
+
BOSNIAN: string;
|
|
51
|
+
BRETON: string;
|
|
52
|
+
BULGARIAN: string;
|
|
53
|
+
CATALAN: string;
|
|
54
|
+
CHINESE: string;
|
|
55
|
+
CROATIAN: string;
|
|
56
|
+
CZECH: string;
|
|
57
|
+
DANISH: string;
|
|
58
|
+
DUTCH: string;
|
|
59
|
+
ENGLISH: string;
|
|
60
|
+
ESPERANTO: string;
|
|
61
|
+
ESTONIAN: string;
|
|
62
|
+
FINNISH: string;
|
|
63
|
+
FRENCH: string;
|
|
64
|
+
FRISIAN: string;
|
|
65
|
+
GEORGIAN: string;
|
|
66
|
+
GERMAN: string;
|
|
67
|
+
GREEK: string;
|
|
68
|
+
HEBREW: string;
|
|
69
|
+
HUNGARIAN: string;
|
|
70
|
+
ICELANDIC: string;
|
|
71
|
+
IRISH: string;
|
|
72
|
+
ITALIAN: string;
|
|
73
|
+
JAPANESE: string;
|
|
74
|
+
KANNADA: string;
|
|
75
|
+
KAZAKH: string;
|
|
76
|
+
KOREAN: string;
|
|
77
|
+
ROMAN_LATIN: string;
|
|
78
|
+
LATVIAN: string;
|
|
79
|
+
LITHUANIAN: string;
|
|
80
|
+
LUXEMBOURGISH: string;
|
|
81
|
+
MACEDONIAN: string;
|
|
82
|
+
MALTESE: string;
|
|
83
|
+
NORWEGIAN: string;
|
|
84
|
+
POLISH: string;
|
|
85
|
+
PORTUGUESE: string;
|
|
86
|
+
ROMANIAN: string;
|
|
87
|
+
ROMANSH: string;
|
|
88
|
+
RUSSIAN: string;
|
|
89
|
+
SCOTTISH_GAELIC: string;
|
|
90
|
+
SERBIAN_CYRILLIC: string;
|
|
91
|
+
SLOVAK: string;
|
|
92
|
+
SLOVENE: string;
|
|
93
|
+
SPANISH: string;
|
|
94
|
+
SWEDISH: string;
|
|
95
|
+
THAI: string;
|
|
96
|
+
TURKISH: string;
|
|
97
|
+
UKRAINIAN: string;
|
|
98
|
+
WELSH: string;
|
|
99
|
+
};
|
|
100
|
+
type Values<T> = T[keyof T];
|
|
101
|
+
/**
|
|
102
|
+
* Built-in languages values as strings
|
|
103
|
+
*/
|
|
104
|
+
type LanguageGeocodingString = Values<typeof LanguageGeocoding>;
|
|
105
|
+
|
|
106
|
+
type GeocodingOptions = {
|
|
107
|
+
/**
|
|
108
|
+
* Custom mapTiler Cloud API key to use instead of the one in global `config`
|
|
109
|
+
*/
|
|
110
|
+
apiKey?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Only search for results in the specified area.
|
|
113
|
+
*/
|
|
114
|
+
bbox?: BBox;
|
|
115
|
+
/**
|
|
116
|
+
* Prefer results close to a specific location.
|
|
117
|
+
*/
|
|
118
|
+
proximity?: Position;
|
|
119
|
+
/**
|
|
120
|
+
* Prefer results in specific language. It’s possible to specify multiple values.
|
|
121
|
+
*/
|
|
122
|
+
language?: LanguageGeocodingString | Array<LanguageGeocodingString>;
|
|
123
|
+
};
|
|
124
|
+
type Coordinates = Position;
|
|
125
|
+
type FeatureHierarchy = {
|
|
126
|
+
/**
|
|
127
|
+
* Unique feature ID
|
|
128
|
+
*/
|
|
129
|
+
id: string;
|
|
130
|
+
/**
|
|
131
|
+
* Localized feature name
|
|
132
|
+
*/
|
|
133
|
+
text: string;
|
|
134
|
+
};
|
|
135
|
+
type GeocodingFeature = Feature & {
|
|
136
|
+
/**
|
|
137
|
+
* Bounding box of the original feature as [w, s, e, n] array
|
|
138
|
+
*/
|
|
139
|
+
bbox: BBox;
|
|
140
|
+
/**
|
|
141
|
+
* A [lon, lat] array of the original feature centeroid
|
|
142
|
+
*/
|
|
143
|
+
center: Coordinates;
|
|
144
|
+
/**
|
|
145
|
+
* Formatted (including the hierarchy) and localized feature full name
|
|
146
|
+
*/
|
|
147
|
+
place_name: string;
|
|
148
|
+
/**
|
|
149
|
+
* Localized feature name
|
|
150
|
+
*/
|
|
151
|
+
text: string;
|
|
152
|
+
/**
|
|
153
|
+
* Feature hierarchy
|
|
154
|
+
*/
|
|
155
|
+
context?: Array<FeatureHierarchy>;
|
|
156
|
+
/**
|
|
157
|
+
* Address number, if applicable
|
|
158
|
+
*/
|
|
159
|
+
address?: string;
|
|
160
|
+
};
|
|
161
|
+
type GeocodingSearchResult = {
|
|
162
|
+
type: "FeatureCollection";
|
|
163
|
+
/**
|
|
164
|
+
* Array of features found
|
|
165
|
+
*/
|
|
166
|
+
features: Array<GeocodingFeature>;
|
|
167
|
+
/**
|
|
168
|
+
* Tokenized search query
|
|
169
|
+
*/
|
|
170
|
+
query: Array<string>;
|
|
171
|
+
/**
|
|
172
|
+
* Attribution of the result
|
|
173
|
+
*/
|
|
174
|
+
attribution: string;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Performs a forward geocoding query to MapTiler API.
|
|
178
|
+
* Providing a human readable place name (of a city, country, street, etc.), the function returns
|
|
179
|
+
* a list of candidate locations including longitude and latitude.
|
|
180
|
+
* Learn more on the MapTiler API reference page: https://docs.maptiler.com/cloud/api/geocoding/#search-by-name-forward
|
|
181
|
+
* @param query
|
|
182
|
+
* @param options
|
|
183
|
+
* @returns
|
|
184
|
+
*/
|
|
185
|
+
declare function forward(query: string, options?: GeocodingOptions): Promise<GeocodingSearchResult>;
|
|
186
|
+
type ReverseGeocodingOptions = {
|
|
187
|
+
/**
|
|
188
|
+
* Custom mapTiler Cloud API key to use instead of the one in global `config`
|
|
189
|
+
*/
|
|
190
|
+
apiKey?: string;
|
|
191
|
+
/**
|
|
192
|
+
* Prefer results in specific language. It’s possible to specify multiple values.
|
|
193
|
+
*/
|
|
194
|
+
language?: LanguageGeocodingString | Array<LanguageGeocodingString>;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Perform a reverse geocoding query to MapTiler API.
|
|
198
|
+
* Providing a longitude and latitude, this function returns a set of human readable information abou this place (country, city, street, etc.)
|
|
199
|
+
* Learn more on the MapTiler API reference page: https://docs.maptiler.com/cloud/api/geocoding/#search-by-coordinates-reverse
|
|
200
|
+
* @param position
|
|
201
|
+
* @param options
|
|
202
|
+
* @returns
|
|
203
|
+
*/
|
|
204
|
+
declare function reverse(position: Position, options?: ReverseGeocodingOptions): Promise<GeocodingSearchResult>;
|
|
205
|
+
/**
|
|
206
|
+
* The **geocoding** namespace contains asynchronous functions to call the [MapTiler Geocoding API](https://docs.maptiler.com/cloud/api/geocoding/).
|
|
207
|
+
* The **Geocoding API** provides ways to get geographic coordinates from a human-readable search query of a place (forward geocoding)
|
|
208
|
+
* and to get the location details (country, city, street, etc.) from a geographic coordinate (reverse geocoding);
|
|
209
|
+
*/
|
|
210
|
+
declare const geocoding: {
|
|
211
|
+
forward: typeof forward;
|
|
212
|
+
reverse: typeof reverse;
|
|
213
|
+
language: {
|
|
214
|
+
AUTO: string;
|
|
215
|
+
ALBANIAN: string;
|
|
216
|
+
ARABIC: string;
|
|
217
|
+
ARMENIAN: string;
|
|
218
|
+
AZERBAIJANI: string;
|
|
219
|
+
BELORUSSIAN: string;
|
|
220
|
+
BOSNIAN: string;
|
|
221
|
+
BRETON: string;
|
|
222
|
+
BULGARIAN: string;
|
|
223
|
+
CATALAN: string;
|
|
224
|
+
CHINESE: string;
|
|
225
|
+
CROATIAN: string;
|
|
226
|
+
CZECH: string;
|
|
227
|
+
DANISH: string;
|
|
228
|
+
DUTCH: string;
|
|
229
|
+
ENGLISH: string;
|
|
230
|
+
ESPERANTO: string;
|
|
231
|
+
ESTONIAN: string;
|
|
232
|
+
/**
|
|
233
|
+
* Custom mapTiler Cloud API key to use instead of the one in global `config`
|
|
234
|
+
*/
|
|
235
|
+
FINNISH: string;
|
|
236
|
+
FRENCH: string;
|
|
237
|
+
FRISIAN: string;
|
|
238
|
+
GEORGIAN: string;
|
|
239
|
+
GERMAN: string;
|
|
240
|
+
GREEK: string;
|
|
241
|
+
HEBREW: string; /**
|
|
242
|
+
* Only search for results in the specified area.
|
|
243
|
+
*/
|
|
244
|
+
HUNGARIAN: string;
|
|
245
|
+
ICELANDIC: string;
|
|
246
|
+
IRISH: string;
|
|
247
|
+
ITALIAN: string;
|
|
248
|
+
JAPANESE: string;
|
|
249
|
+
KANNADA: string;
|
|
250
|
+
KAZAKH: string;
|
|
251
|
+
KOREAN: string;
|
|
252
|
+
ROMAN_LATIN: string;
|
|
253
|
+
LATVIAN: string;
|
|
254
|
+
LITHUANIAN: string;
|
|
255
|
+
LUXEMBOURGISH: string;
|
|
256
|
+
MACEDONIAN: string;
|
|
257
|
+
MALTESE: string;
|
|
258
|
+
NORWEGIAN: string;
|
|
259
|
+
POLISH: string;
|
|
260
|
+
PORTUGUESE: string;
|
|
261
|
+
ROMANIAN: string;
|
|
262
|
+
ROMANSH: string;
|
|
263
|
+
RUSSIAN: string;
|
|
264
|
+
SCOTTISH_GAELIC: string;
|
|
265
|
+
SERBIAN_CYRILLIC: string;
|
|
266
|
+
SLOVAK: string;
|
|
267
|
+
SLOVENE: string;
|
|
268
|
+
SPANISH: string;
|
|
269
|
+
SWEDISH: string;
|
|
270
|
+
THAI: string;
|
|
271
|
+
TURKISH: string;
|
|
272
|
+
UKRAINIAN: string;
|
|
273
|
+
WELSH: string;
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Options that can be provided to get user data.
|
|
279
|
+
*/
|
|
280
|
+
type GeolocationInfoOptions = {
|
|
281
|
+
/**
|
|
282
|
+
* Custom mapTiler Cloud API key to use instead of the one in global `config`
|
|
283
|
+
*/
|
|
284
|
+
apiKey?: string;
|
|
285
|
+
};
|
|
286
|
+
type GeolocationResult = {
|
|
287
|
+
/**
|
|
288
|
+
* Name of the country
|
|
289
|
+
* Example: Switzerland
|
|
290
|
+
*/
|
|
291
|
+
country?: string;
|
|
292
|
+
/**
|
|
293
|
+
* Two-letter code of the country ISO 3166-1 alpha-2 codes
|
|
294
|
+
* Example: CH
|
|
295
|
+
*/
|
|
296
|
+
country_code?: string;
|
|
297
|
+
/**
|
|
298
|
+
* Bounds of the country in WGS84 degrees [west, south, east, north].
|
|
299
|
+
* Example: [5.95538,45.818852,10.490936,47.809357]
|
|
300
|
+
*/
|
|
301
|
+
country_bounds?: BBox;
|
|
302
|
+
/**
|
|
303
|
+
* Official country languages in ISO 639-1 format. ISO 639-1 codes
|
|
304
|
+
* Example: ["de","fr","it"]
|
|
305
|
+
*/
|
|
306
|
+
country_languages?: Array<string>;
|
|
307
|
+
/**
|
|
308
|
+
* Name of the continent
|
|
309
|
+
* Example: Europe
|
|
310
|
+
*/
|
|
311
|
+
continent?: string;
|
|
312
|
+
/**
|
|
313
|
+
* Two-letter code of the continent
|
|
314
|
+
* Example: EU
|
|
315
|
+
*/
|
|
316
|
+
continent_code?: string;
|
|
317
|
+
/**
|
|
318
|
+
* Indicated whether the country is part of the European Union.
|
|
319
|
+
*/
|
|
320
|
+
eu?: boolean;
|
|
321
|
+
/**
|
|
322
|
+
* Name of the city
|
|
323
|
+
* Example: Zurich
|
|
324
|
+
*/
|
|
325
|
+
city?: string;
|
|
326
|
+
/**
|
|
327
|
+
* Latitude of the location
|
|
328
|
+
* Example: 47.36667
|
|
329
|
+
*/
|
|
330
|
+
latitude?: number;
|
|
331
|
+
/**
|
|
332
|
+
* Longitude of the location
|
|
333
|
+
* Example: 8.55
|
|
334
|
+
*/
|
|
335
|
+
longitude?: number;
|
|
336
|
+
/**
|
|
337
|
+
* Postal code
|
|
338
|
+
* Example: 8000
|
|
339
|
+
*/
|
|
340
|
+
postal?: string;
|
|
341
|
+
/**
|
|
342
|
+
* If known, the ISO 3166-2 name for the first level region. ISO 3166-2 codes
|
|
343
|
+
* Example: Zurich
|
|
344
|
+
*/
|
|
345
|
+
region?: string;
|
|
346
|
+
/**
|
|
347
|
+
* If known, the ISO 3166-2 code for the first level region. ISO 3166-2 codes
|
|
348
|
+
* Example: ZH
|
|
349
|
+
*/
|
|
350
|
+
region_code?: string;
|
|
351
|
+
/**
|
|
352
|
+
* Name of the timezone
|
|
353
|
+
* Example: Europe/Zurich
|
|
354
|
+
*/
|
|
355
|
+
timezone?: string;
|
|
356
|
+
};
|
|
357
|
+
/**
|
|
358
|
+
* Looks up geolocation details from IP address using MapTiler API.
|
|
359
|
+
* Learn more on the MapTiler API reference page: https://docs.maptiler.com/cloud/api/geolocation/#ip-geolocation
|
|
360
|
+
* @returns
|
|
361
|
+
*/
|
|
362
|
+
declare function info(options?: GeolocationInfoOptions): Promise<GeolocationResult>;
|
|
363
|
+
/**
|
|
364
|
+
* The **geolocation** namespace contains an asynchronous function to call the [MapTiler Geolocation API](https://docs.maptiler.com/cloud/api/geolocation/).
|
|
365
|
+
* The **Geolocation API** provides a way to retrieve the IP address as well as geographic informations of a machine performing the query (most likely: a user)
|
|
366
|
+
*/
|
|
367
|
+
declare const geolocation: {
|
|
368
|
+
info: typeof info;
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
type CoordinatesSearchOptions = {
|
|
372
|
+
/**
|
|
373
|
+
* Custom mapTiler Cloud API key to use instead of the one in global `config`
|
|
374
|
+
*/
|
|
375
|
+
apiKey?: string;
|
|
376
|
+
/**
|
|
377
|
+
* Maximum number of results returned (default: 10)
|
|
378
|
+
*/
|
|
379
|
+
limit?: number;
|
|
380
|
+
/**
|
|
381
|
+
* Show detailed transformations for each CRS (default: false)
|
|
382
|
+
*/
|
|
383
|
+
transformations?: boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Show exports in WKT and Proj4 notations (default: false)
|
|
386
|
+
*/
|
|
387
|
+
exports?: boolean;
|
|
388
|
+
};
|
|
389
|
+
type CoordinateId = {
|
|
390
|
+
authority: string;
|
|
391
|
+
code: BigInteger;
|
|
392
|
+
};
|
|
393
|
+
type CoordinateExport = {
|
|
394
|
+
proj4: string;
|
|
395
|
+
wkt: string;
|
|
396
|
+
};
|
|
397
|
+
type CoordinateGrid = {
|
|
398
|
+
path: string;
|
|
399
|
+
};
|
|
400
|
+
type CoordinateTransformation = {
|
|
401
|
+
id: CoordinateId;
|
|
402
|
+
name: string;
|
|
403
|
+
reversible: boolean;
|
|
404
|
+
usable: boolean;
|
|
405
|
+
deprecated: boolean;
|
|
406
|
+
grids: Array<CoordinateGrid>;
|
|
407
|
+
accuracy?: number;
|
|
408
|
+
area?: string;
|
|
409
|
+
bbox?: BBox;
|
|
410
|
+
target_crs?: CoordinateId;
|
|
411
|
+
unit?: string;
|
|
412
|
+
};
|
|
413
|
+
type CoordinateSearch = {
|
|
414
|
+
id: CoordinateId;
|
|
415
|
+
name: string;
|
|
416
|
+
kind: string;
|
|
417
|
+
deprecated: boolean;
|
|
418
|
+
transformations?: Array<CoordinateTransformation | number>;
|
|
419
|
+
accuracy?: number;
|
|
420
|
+
unit?: string;
|
|
421
|
+
area?: string;
|
|
422
|
+
/**
|
|
423
|
+
* Bounding box of the resource in [min_lon, min_lat, max_lon, max_lat] order.
|
|
424
|
+
*/
|
|
425
|
+
bbox?: BBox;
|
|
426
|
+
/**
|
|
427
|
+
* Most suitable transformation for this CRS.
|
|
428
|
+
*/
|
|
429
|
+
default_transformation?: any;
|
|
430
|
+
exports: CoordinateExport;
|
|
431
|
+
};
|
|
432
|
+
type CoordinateSearchResult = {
|
|
433
|
+
/**
|
|
434
|
+
* The coordinate search results
|
|
435
|
+
*/
|
|
436
|
+
results: Array<CoordinateSearch>;
|
|
437
|
+
/**
|
|
438
|
+
* The number of results
|
|
439
|
+
*/
|
|
440
|
+
total: number;
|
|
441
|
+
};
|
|
442
|
+
/**
|
|
443
|
+
* Search information about coordinate systems using MapTiler API.
|
|
444
|
+
* Learn more on the MapTiler API reference page: https://docs.maptiler.com/cloud/api/coordinates/#search-coordinate-systems
|
|
445
|
+
* @param query Can be any kind of CRS by name or code
|
|
446
|
+
* @param options
|
|
447
|
+
* @returns
|
|
448
|
+
*/
|
|
449
|
+
declare function search(query: string, options?: CoordinatesSearchOptions): Promise<CoordinateSearchResult>;
|
|
450
|
+
type XYZ = {
|
|
451
|
+
x?: number;
|
|
452
|
+
y?: number;
|
|
453
|
+
z?: number;
|
|
454
|
+
};
|
|
455
|
+
type CoordinateTransformResult = {
|
|
456
|
+
results: Array<XYZ>;
|
|
457
|
+
/**
|
|
458
|
+
* Transformations are selected using given ops parameter.
|
|
459
|
+
* If no parameter is given, auto strategy is used.
|
|
460
|
+
* If given, it may try to use a listed transformation,
|
|
461
|
+
* then fallback to towgs84 patching, and finally boundcrs.
|
|
462
|
+
*/
|
|
463
|
+
transformer_selection_strategy: string;
|
|
464
|
+
};
|
|
465
|
+
/**
|
|
466
|
+
* Options that can be provided when transforming a coordinate from one CRS to another.
|
|
467
|
+
*/
|
|
468
|
+
type CoordinatesTransformOptions = {
|
|
469
|
+
/**
|
|
470
|
+
* Custom mapTiler Cloud API key to use instead of the one in global `config`
|
|
471
|
+
*/
|
|
472
|
+
apiKey?: string;
|
|
473
|
+
/**
|
|
474
|
+
* Source coordinate reference system (default: 4326)
|
|
475
|
+
*/
|
|
476
|
+
sourceCrs?: number;
|
|
477
|
+
/**
|
|
478
|
+
* Target coordinate reference system (default: 4326)
|
|
479
|
+
*/
|
|
480
|
+
targetCrs?: number;
|
|
481
|
+
/**
|
|
482
|
+
* List of codes of operations
|
|
483
|
+
*/
|
|
484
|
+
operations?: number | Array<number>;
|
|
485
|
+
};
|
|
486
|
+
/**
|
|
487
|
+
* Transforms coordinates from a source reference system to a target reference system using MapTiler API.
|
|
488
|
+
* Learn more on the MapTiler API reference page: https://docs.maptiler.com/cloud/api/coordinates/#transform-coordinates
|
|
489
|
+
* @param positions
|
|
490
|
+
* @param options
|
|
491
|
+
* @returns
|
|
492
|
+
*/
|
|
493
|
+
declare function transform(positions: Position | Array<Position>, options?: CoordinatesTransformOptions): Promise<CoordinateTransformResult>;
|
|
494
|
+
/**
|
|
495
|
+
* The **coordinate** namespace contains asynchronous functions to call the [MapTiler Coordinate API](https://docs.maptiler.com/cloud/api/coordinates/).
|
|
496
|
+
* The goal of the **Coordinate API* is query information about spatial coordinate reference system (CRS) as well as to transform coordinates from one CRS to another.
|
|
497
|
+
*/
|
|
498
|
+
declare const coordinates: {
|
|
499
|
+
search: typeof search;
|
|
500
|
+
transform: typeof transform;
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Options that can be provided to get user data.
|
|
505
|
+
*/
|
|
506
|
+
type GetDataOptions = {
|
|
507
|
+
/**
|
|
508
|
+
* Custom mapTiler Cloud API key to use instead of the one in global `config`
|
|
509
|
+
*/
|
|
510
|
+
apiKey?: string;
|
|
511
|
+
};
|
|
512
|
+
/**
|
|
513
|
+
* Get user data and returns it as GeoJSON using the MapTiler API.
|
|
514
|
+
* Learn more on the MapTiler API reference page: https://docs.maptiler.com/cloud/api/data/#geojson
|
|
515
|
+
* @param dataId
|
|
516
|
+
* @returns
|
|
517
|
+
*/
|
|
518
|
+
declare function get(dataId: string, options?: GetDataOptions): Promise<FeatureCollection>;
|
|
519
|
+
/**
|
|
520
|
+
* The **data** namespace contains an asynchronous function to call the [MapTiler Data API](https://docs.maptiler.com/cloud/api/data/).
|
|
521
|
+
* The **Data API** provides a way to retrieve user data in GeoJSON format.
|
|
522
|
+
*/
|
|
523
|
+
declare const data: {
|
|
524
|
+
get: typeof get;
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Base set of options that can be provided to all the types of static maps
|
|
529
|
+
*/
|
|
530
|
+
type StaticMapBaseOptions = {
|
|
531
|
+
/**
|
|
532
|
+
* Custom mapTiler Cloud API key to use instead of the one in global `config`
|
|
533
|
+
*/
|
|
534
|
+
apiKey?: string;
|
|
535
|
+
/**
|
|
536
|
+
* Style of the map (not full style URL). Example: "winter", "streets-v2".
|
|
537
|
+
* Default: `"streets-v2"`
|
|
538
|
+
*/
|
|
539
|
+
style?: string;
|
|
540
|
+
/**
|
|
541
|
+
* Double the size of the static map image to support hiDPI/Retina monitors.
|
|
542
|
+
* Default: `false`
|
|
543
|
+
*/
|
|
544
|
+
hiDPI?: boolean;
|
|
545
|
+
/**
|
|
546
|
+
* Image format.
|
|
547
|
+
* Default: `"png"`
|
|
548
|
+
*/
|
|
549
|
+
format?: "png" | "jpg" | "webp";
|
|
550
|
+
/**
|
|
551
|
+
* Width of the output image. Maximum value: `2048`.
|
|
552
|
+
* Default: `1024`
|
|
553
|
+
*/
|
|
554
|
+
width?: number;
|
|
555
|
+
/**
|
|
556
|
+
* Height of the output image. Maximum value: `2048`.
|
|
557
|
+
* Default: `1024`
|
|
558
|
+
*/
|
|
559
|
+
height?: number;
|
|
560
|
+
/**
|
|
561
|
+
* Placement of the attribution. Can also be set to `false` to not show attribution.
|
|
562
|
+
* Default: `"bottomright"`
|
|
563
|
+
*/
|
|
564
|
+
attribution?: "bottomright" | "bottomleft" | "topleft" | "topright" | false;
|
|
565
|
+
/**
|
|
566
|
+
* A marker or list of markers to show on the map
|
|
567
|
+
* Default: none provided
|
|
568
|
+
*/
|
|
569
|
+
markers?: StaticMapMarker | Array<StaticMapMarker>;
|
|
570
|
+
/**
|
|
571
|
+
* URL of the marker image. Applies only if one or multiple markers positions are provided.
|
|
572
|
+
* Default: none provided
|
|
573
|
+
*/
|
|
574
|
+
markerIcon?: string;
|
|
575
|
+
/**
|
|
576
|
+
* Position of the marker regarding its coordinates. Applies only:
|
|
577
|
+
* - with a custom icon provided with `markerIcon`
|
|
578
|
+
* - if one or multiple markers positions are provided.
|
|
579
|
+
* Default: `"bottom"`
|
|
580
|
+
*/
|
|
581
|
+
markerAnchor?: "top" | "left" | "bottom" | "right" | "center" | "topleft" | "bottomleft" | "topright" | "bottomright";
|
|
582
|
+
/**
|
|
583
|
+
* Draw a path or polygon on top of the map. If the path is too long it will be simplified, yet remaining accurate.
|
|
584
|
+
* Default: none provided
|
|
585
|
+
*/
|
|
586
|
+
path?: Array<Position>;
|
|
587
|
+
/**
|
|
588
|
+
* Color of the path line. The color must be CSS compatible.
|
|
589
|
+
* Examples:
|
|
590
|
+
* - long form hex without transparency `"#FF0000"` (red)
|
|
591
|
+
* - short form hex without transparency `"#F00"` (red)
|
|
592
|
+
* - long form hex with transparency `"#FF000008"` (red, half opacity)
|
|
593
|
+
* - short form hex with transparency `"#F008"` (red, half opacity)
|
|
594
|
+
* - CSS color shorthands: `"red"`, `"chartreuse"`, etc.
|
|
595
|
+
* - decimal RGB values without transparency: `"rgb(128, 100, 255)"`
|
|
596
|
+
* - decimal RGB values with transparency: `"rgb(128, 100, 255, 0.5)"`
|
|
597
|
+
* Default: `"blue"`
|
|
598
|
+
*/
|
|
599
|
+
pathStrokeColor?: string;
|
|
600
|
+
/**
|
|
601
|
+
* Color of the filling, also works if the polygon is not closed. The color must be CSS compatible.
|
|
602
|
+
* Examples:
|
|
603
|
+
* - long form hex without transparency `"#FF0000"` (red)
|
|
604
|
+
* - short form hex without transparency `"#F00"` (red)
|
|
605
|
+
* - long form hex with transparency `"#FF000008"` (red, half opacity)
|
|
606
|
+
* - short form hex with transparency `"#F008"` (red, half opacity)
|
|
607
|
+
* - CSS color shorthands: `"red"`, `"chartreuse"`, etc.
|
|
608
|
+
* - decimal RGB values without transparency: `"rgb(128, 100, 255)"`
|
|
609
|
+
* - decimal RGB values with transparency: `"rgb(128, 100, 255, 0.5)"`
|
|
610
|
+
* Default: none (transparent filling)
|
|
611
|
+
*/
|
|
612
|
+
pathFillColor?: string;
|
|
613
|
+
/**
|
|
614
|
+
* Width of the path line in pixel. It can be floating point precision (ex: `0.5`)
|
|
615
|
+
* Default: `1` if `hiDPI` is `false` and `2` if `hiDPI` is `true`.
|
|
616
|
+
*/
|
|
617
|
+
pathWidth?: number;
|
|
618
|
+
};
|
|
619
|
+
/**
|
|
620
|
+
* Options that can be provided to centered static maps
|
|
621
|
+
*/
|
|
622
|
+
type CenteredStaticMapOptions = StaticMapBaseOptions;
|
|
623
|
+
/**
|
|
624
|
+
* Options that can be provided to bounded static maps
|
|
625
|
+
*/
|
|
626
|
+
type BoundedStaticMapOptions = StaticMapBaseOptions & {
|
|
627
|
+
/**
|
|
628
|
+
* Extra space added around the regio of interest, in percentage.
|
|
629
|
+
* Default: `0.1` (for 10%)
|
|
630
|
+
*/
|
|
631
|
+
padding?: number;
|
|
632
|
+
};
|
|
633
|
+
/**
|
|
634
|
+
* Options that can be provided to automatic static maps
|
|
635
|
+
*/
|
|
636
|
+
type AutomaticStaticMapOptions = BoundedStaticMapOptions;
|
|
637
|
+
/**
|
|
638
|
+
* Definition of a maker to show on a static map
|
|
639
|
+
*/
|
|
640
|
+
type StaticMapMarker = [
|
|
641
|
+
/**
|
|
642
|
+
* Longitude of the marker
|
|
643
|
+
*/
|
|
644
|
+
number,
|
|
645
|
+
/**
|
|
646
|
+
* latitude of the marker
|
|
647
|
+
*/
|
|
648
|
+
number,
|
|
649
|
+
/**
|
|
650
|
+
* Color of the marker with CSS syntax. Applies only if a custom `markerIcon` is not provided.
|
|
651
|
+
*/
|
|
652
|
+
string
|
|
653
|
+
];
|
|
654
|
+
/**
|
|
655
|
+
* Construct the URL for a static map centered on one point.
|
|
656
|
+
* Note: this function does not fetch the binary content of the image since
|
|
657
|
+
* the purpose of a static map is generally to have its URL as a `src` property of a <img/> element.
|
|
658
|
+
* If a path is provided and is too long, it will be simplified in an accurate way.
|
|
659
|
+
* @param center
|
|
660
|
+
* @param zoom
|
|
661
|
+
* @param options
|
|
662
|
+
* @returns
|
|
663
|
+
*/
|
|
664
|
+
declare function centered(center: Position, zoom: number, options?: CenteredStaticMapOptions): string;
|
|
665
|
+
/**
|
|
666
|
+
* Construct the URL for a static map using a bounding box
|
|
667
|
+
* Note: this function does not fetch the binary content of the image since
|
|
668
|
+
* the purpose of a static map is generally to have its URL as a `src` property of a <img/> element.
|
|
669
|
+
* If a path is provided and is too long, it will be simplified in an accurate way.
|
|
670
|
+
* @param boundingBox
|
|
671
|
+
* @param options
|
|
672
|
+
* @returns
|
|
673
|
+
*/
|
|
674
|
+
declare function bounded(boundingBox: BBox, options?: BoundedStaticMapOptions): string;
|
|
675
|
+
/**
|
|
676
|
+
* Construct the URL for a static map automatically fitted around the provided path or markers.
|
|
677
|
+
* Note: this function does not fetch the binary content of the image since
|
|
678
|
+
* the purpose of a static map is generally to have its URL as a `src` property of a <img/> element.
|
|
679
|
+
* If a path is provided and is too long, it will be simplified in an accurate way.
|
|
680
|
+
* @param options
|
|
681
|
+
* @returns
|
|
682
|
+
*/
|
|
683
|
+
declare function automatic(options?: AutomaticStaticMapOptions): string;
|
|
684
|
+
/**
|
|
685
|
+
* The **staticMaps** namespace contains an synchronous function build image URL of static map, as specified by the [MapTiler Static Map API](https://docs.maptiler.com/cloud/api/static-maps/).
|
|
686
|
+
* The URL of static maps can then be used within a `<img />` markup element, as the `src` property value.
|
|
687
|
+
*/
|
|
688
|
+
declare const staticMaps: {
|
|
689
|
+
centered: typeof centered;
|
|
690
|
+
bounded: typeof bounded;
|
|
691
|
+
automatic: typeof automatic;
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* A ServiceError is an Error that includes the HTTP response details
|
|
696
|
+
*/
|
|
697
|
+
declare class ServiceError extends Error {
|
|
698
|
+
res: Response;
|
|
699
|
+
constructor(res: Response, customMessage?: string);
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
export { AutomaticStaticMapOptions, BoundedStaticMapOptions, CenteredStaticMapOptions, ClientConfig, CoordinateExport, CoordinateGrid, CoordinateId, CoordinateSearch, CoordinateSearchResult, CoordinateTransformResult, CoordinateTransformation, Coordinates, CoordinatesSearchOptions, CoordinatesTransformOptions, FeatureHierarchy, FetchFunction, GeocodingFeature, GeocodingOptions, GeocodingSearchResult, GeolocationInfoOptions, GeolocationResult, GetDataOptions, LanguageGeocoding, LanguageGeocodingString, ReverseGeocodingOptions, ServiceError, StaticMapBaseOptions, StaticMapMarker, XYZ, config, coordinates, data, geocoding, geolocation, staticMaps };
|