@maptiler/client 1.0.3 β†’ 1.1.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.
Files changed (72) hide show
  1. package/dist/maptiler-client.cjs +465 -21
  2. package/dist/maptiler-client.cjs.map +1 -1
  3. package/dist/maptiler-client.d.ts +395 -2
  4. package/dist/maptiler-client.min.mjs +1 -1
  5. package/dist/maptiler-client.mjs +461 -22
  6. package/dist/maptiler-client.mjs.map +1 -1
  7. package/dist/maptiler-client.umd.js +465 -21
  8. package/dist/maptiler-client.umd.js.map +1 -1
  9. package/dist/maptiler-client.umd.min.js +1 -1
  10. package/docs/assets/custom.css +28 -1
  11. package/docs/classes/config.ClientConfig.html +9 -9
  12. package/docs/classes/services_ServiceError.ServiceError.html +7 -7
  13. package/docs/functions/language.getAutoLanguageGeocoding.html +5 -5
  14. package/docs/functions/services_simplify.default.html +5 -5
  15. package/docs/index.html +98 -10
  16. package/docs/modules/config.html +5 -5
  17. package/docs/modules/language.html +5 -5
  18. package/docs/modules/services_ServiceError.html +5 -5
  19. package/docs/modules/services_coordinates.html +5 -5
  20. package/docs/modules/services_data.html +5 -5
  21. package/docs/modules/services_geocoding.html +5 -5
  22. package/docs/modules/services_geolocation.html +5 -5
  23. package/docs/modules/services_simplify.html +5 -5
  24. package/docs/modules/services_staticMaps.html +5 -5
  25. package/docs/modules.html +4 -4
  26. package/docs/types/config.FetchFunction.html +5 -5
  27. package/docs/types/language.LanguageGeocodingString.html +5 -5
  28. package/docs/types/services_coordinates.CoordinateExport.html +5 -5
  29. package/docs/types/services_coordinates.CoordinateGrid.html +5 -5
  30. package/docs/types/services_coordinates.CoordinateId.html +5 -5
  31. package/docs/types/services_coordinates.CoordinateSearch.html +5 -5
  32. package/docs/types/services_coordinates.CoordinateSearchResult.html +5 -5
  33. package/docs/types/services_coordinates.CoordinateTransformResult.html +5 -5
  34. package/docs/types/services_coordinates.CoordinateTransformation.html +5 -5
  35. package/docs/types/services_coordinates.CoordinatesSearchOptions.html +5 -5
  36. package/docs/types/services_coordinates.CoordinatesTransformOptions.html +5 -5
  37. package/docs/types/services_coordinates.XYZ.html +5 -5
  38. package/docs/types/services_data.GetDataOptions.html +5 -5
  39. package/docs/types/services_geocoding.Coordinates.html +5 -5
  40. package/docs/types/services_geocoding.FeatureHierarchy.html +5 -5
  41. package/docs/types/services_geocoding.GeocodingFeature.html +5 -5
  42. package/docs/types/services_geocoding.GeocodingOptions.html +5 -5
  43. package/docs/types/services_geocoding.GeocodingSearchResult.html +5 -5
  44. package/docs/types/services_geocoding.ReverseGeocodingOptions.html +5 -5
  45. package/docs/types/services_geolocation.GeolocationInfoOptions.html +5 -5
  46. package/docs/types/services_geolocation.GeolocationResult.html +5 -5
  47. package/docs/types/services_staticMaps.AutomaticStaticMapOptions.html +5 -5
  48. package/docs/types/services_staticMaps.BoundedStaticMapOptions.html +5 -5
  49. package/docs/types/services_staticMaps.CenteredStaticMapOptions.html +5 -5
  50. package/docs/types/services_staticMaps.StaticMapBaseOptions.html +7 -7
  51. package/docs/types/services_staticMaps.StaticMapMarker.html +5 -5
  52. package/docs/variables/config.config.html +5 -5
  53. package/docs/variables/language.LanguageGeocoding.html +5 -5
  54. package/docs/variables/services_coordinates.coordinates.html +5 -5
  55. package/docs/variables/services_data.data.html +5 -5
  56. package/docs/variables/services_geocoding.geocoding.html +5 -5
  57. package/docs/variables/services_geolocation.geolocation.html +5 -5
  58. package/docs/variables/services_staticMaps.staticMaps.html +5 -5
  59. package/docsmd/README.md +143 -36
  60. package/docsmd/assets/custom.css +28 -1
  61. package/docsmd/classes/ClientConfig.md +5 -5
  62. package/docsmd/classes/MapStyleVariant.md +217 -0
  63. package/docsmd/classes/ReferenceMapStyle.md +169 -0
  64. package/docsmd/classes/ServiceError.md +3 -3
  65. package/examples/test-browser-umd.html +1 -1
  66. package/package.json +1 -1
  67. package/readme.md +64 -5
  68. package/src/index.ts +17 -0
  69. package/src/mapstyle.ts +841 -0
  70. package/src/services/staticMaps.ts +5 -4
  71. package/tsconfig.json +0 -1
  72. package/typedoc.css +28 -1
@@ -0,0 +1,217 @@
1
+ [MapTiler Client - v1.1.0](../README.md) / MapStyleVariant
2
+
3
+ # Class: MapStyleVariant
4
+
5
+ An instance of MapStyleVariant contains information about a style to use that belong to a reference style
6
+
7
+ ## Table of contents
8
+
9
+ ### Constructors
10
+
11
+ - [constructor](MapStyleVariant.md#constructor)
12
+
13
+ ### Methods
14
+
15
+ - [getDescription](MapStyleVariant.md#getdescription)
16
+ - [getFullName](MapStyleVariant.md#getfullname)
17
+ - [getId](MapStyleVariant.md#getid)
18
+ - [getImageURL](MapStyleVariant.md#getimageurl)
19
+ - [getName](MapStyleVariant.md#getname)
20
+ - [getReferenceStyle](MapStyleVariant.md#getreferencestyle)
21
+ - [getType](MapStyleVariant.md#gettype)
22
+ - [getVariant](MapStyleVariant.md#getvariant)
23
+ - [getVariants](MapStyleVariant.md#getvariants)
24
+ - [hasVariant](MapStyleVariant.md#hasvariant)
25
+
26
+ ## Constructors
27
+
28
+ ### constructor
29
+
30
+ β€’ **new MapStyleVariant**(`name`, `variantType`, `id`, `referenceStyle`, `description`, `imageURL`)
31
+
32
+ #### Parameters
33
+
34
+ | Name | Type | Description |
35
+ | :------ | :------ | :------ |
36
+ | `name` | `string` | Human-friendly name |
37
+ | `variantType` | `string` | Variant name the variant is addressed to from its reference style: `MapStyle.REFERNCE_STYLE_NAME.VARIANT_TYPE` |
38
+ | `id` | `string` | MapTiler Cloud id |
39
+ | `referenceStyle` | [`ReferenceMapStyle`](ReferenceMapStyle.md) | Reference map style, used to retrieve sibling variants |
40
+ | `description` | `string` | Human-friendly description |
41
+ | `imageURL` | `string` | URL to an image describing the style variant |
42
+
43
+ #### Defined in
44
+
45
+ [mapstyle.ts:21](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L21)
46
+
47
+ ## Methods
48
+
49
+ ### getDescription
50
+
51
+ β–Έ **getDescription**(): `string`
52
+
53
+ Get the human-friendly description
54
+
55
+ #### Returns
56
+
57
+ `string`
58
+
59
+ #### Defined in
60
+
61
+ [mapstyle.ts:84](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L84)
62
+
63
+ ___
64
+
65
+ ### getFullName
66
+
67
+ β–Έ **getFullName**(): `string`
68
+
69
+ #### Returns
70
+
71
+ `string`
72
+
73
+ #### Defined in
74
+
75
+ [mapstyle.ts:61](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L61)
76
+
77
+ ___
78
+
79
+ ### getId
80
+
81
+ β–Έ **getId**(): `string`
82
+
83
+ Get the MapTiler Cloud id
84
+
85
+ #### Returns
86
+
87
+ `string`
88
+
89
+ #### Defined in
90
+
91
+ [mapstyle.ts:77](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L77)
92
+
93
+ ___
94
+
95
+ ### getImageURL
96
+
97
+ β–Έ **getImageURL**(): `string`
98
+
99
+ Get the image URL that represent _this_ variant
100
+
101
+ #### Returns
102
+
103
+ `string`
104
+
105
+ #### Defined in
106
+
107
+ [mapstyle.ts:128](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L128)
108
+
109
+ ___
110
+
111
+ ### getName
112
+
113
+ β–Έ **getName**(): `string`
114
+
115
+ Get the human-friendly name
116
+
117
+ #### Returns
118
+
119
+ `string`
120
+
121
+ #### Defined in
122
+
123
+ [mapstyle.ts:57](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L57)
124
+
125
+ ___
126
+
127
+ ### getReferenceStyle
128
+
129
+ β–Έ **getReferenceStyle**(): [`ReferenceMapStyle`](ReferenceMapStyle.md)
130
+
131
+ Get the reference style this variant belongs to
132
+
133
+ #### Returns
134
+
135
+ [`ReferenceMapStyle`](ReferenceMapStyle.md)
136
+
137
+ #### Defined in
138
+
139
+ [mapstyle.ts:92](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L92)
140
+
141
+ ___
142
+
143
+ ### getType
144
+
145
+ β–Έ **getType**(): `string`
146
+
147
+ Get the variant type (eg. "DEFAULT", "DARK", "PASTEL", etc.)
148
+
149
+ #### Returns
150
+
151
+ `string`
152
+
153
+ #### Defined in
154
+
155
+ [mapstyle.ts:69](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L69)
156
+
157
+ ___
158
+
159
+ ### getVariant
160
+
161
+ β–Έ **getVariant**(`variantType`): [`MapStyleVariant`](MapStyleVariant.md)
162
+
163
+ Retrieve the variant of a given type. If not found, will return the "DEFAULT" variant.
164
+ (eg. _this_ "DARK" variant does not have any "PASTEL" variant, then the "DEFAULT" is returned)
165
+
166
+ #### Parameters
167
+
168
+ | Name | Type |
169
+ | :------ | :------ |
170
+ | `variantType` | `string` |
171
+
172
+ #### Returns
173
+
174
+ [`MapStyleVariant`](MapStyleVariant.md)
175
+
176
+ #### Defined in
177
+
178
+ [mapstyle.ts:112](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L112)
179
+
180
+ ___
181
+
182
+ ### getVariants
183
+
184
+ β–Έ **getVariants**(): [`MapStyleVariant`](MapStyleVariant.md)[]
185
+
186
+ Get all the variants for _this_ variants, except _this_ current one
187
+
188
+ #### Returns
189
+
190
+ [`MapStyleVariant`](MapStyleVariant.md)[]
191
+
192
+ #### Defined in
193
+
194
+ [mapstyle.ts:120](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L120)
195
+
196
+ ___
197
+
198
+ ### hasVariant
199
+
200
+ β–Έ **hasVariant**(`variantType`): `boolean`
201
+
202
+ Check if a variant of a given type exists for _this_ variants
203
+ (eg. if this is a "DARK", then we can check if there is a "LIGHT" variant of it)
204
+
205
+ #### Parameters
206
+
207
+ | Name | Type |
208
+ | :------ | :------ |
209
+ | `variantType` | `string` |
210
+
211
+ #### Returns
212
+
213
+ `boolean`
214
+
215
+ #### Defined in
216
+
217
+ [mapstyle.ts:102](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L102)
@@ -0,0 +1,169 @@
1
+ [MapTiler Client - v1.1.0](../README.md) / ReferenceMapStyle
2
+
3
+ # Class: ReferenceMapStyle
4
+
5
+ An instance of reference style contains a list of StyleVariants ordered by relevance
6
+
7
+ ## Table of contents
8
+
9
+ ### Constructors
10
+
11
+ - [constructor](ReferenceMapStyle.md#constructor)
12
+
13
+ ### Methods
14
+
15
+ - [addVariant](ReferenceMapStyle.md#addvariant)
16
+ - [getDefaultVariant](ReferenceMapStyle.md#getdefaultvariant)
17
+ - [getId](ReferenceMapStyle.md#getid)
18
+ - [getName](ReferenceMapStyle.md#getname)
19
+ - [getVariant](ReferenceMapStyle.md#getvariant)
20
+ - [getVariants](ReferenceMapStyle.md#getvariants)
21
+ - [hasVariant](ReferenceMapStyle.md#hasvariant)
22
+
23
+ ## Constructors
24
+
25
+ ### constructor
26
+
27
+ β€’ **new ReferenceMapStyle**(`name`, `id`)
28
+
29
+ #### Parameters
30
+
31
+ | Name | Type | Description |
32
+ | :------ | :------ | :------ |
33
+ | `name` | `string` | Human-friendly name of this reference style |
34
+ | `id` | `string` | ID of this reference style |
35
+
36
+ #### Defined in
37
+
38
+ [mapstyle.ts:147](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L147)
39
+
40
+ ## Methods
41
+
42
+ ### addVariant
43
+
44
+ β–Έ **addVariant**(`v`): `void`
45
+
46
+ Add a variant to _this_ reference style
47
+
48
+ #### Parameters
49
+
50
+ | Name | Type |
51
+ | :------ | :------ |
52
+ | `v` | [`MapStyleVariant`](MapStyleVariant.md) |
53
+
54
+ #### Returns
55
+
56
+ `void`
57
+
58
+ #### Defined in
59
+
60
+ [mapstyle.ts:179](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L179)
61
+
62
+ ___
63
+
64
+ ### getDefaultVariant
65
+
66
+ β–Έ **getDefaultVariant**(): [`MapStyleVariant`](MapStyleVariant.md)
67
+
68
+ Get the defualt variant for this reference style
69
+
70
+ #### Returns
71
+
72
+ [`MapStyleVariant`](MapStyleVariant.md)
73
+
74
+ #### Defined in
75
+
76
+ [mapstyle.ts:217](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L217)
77
+
78
+ ___
79
+
80
+ ### getId
81
+
82
+ β–Έ **getId**(): `string`
83
+
84
+ Get the id of _this_ reference style
85
+
86
+ #### Returns
87
+
88
+ `string`
89
+
90
+ #### Defined in
91
+
92
+ [mapstyle.ts:171](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L171)
93
+
94
+ ___
95
+
96
+ ### getName
97
+
98
+ β–Έ **getName**(): `string`
99
+
100
+ Get the human-friendly name of this reference style
101
+
102
+ #### Returns
103
+
104
+ `string`
105
+
106
+ #### Defined in
107
+
108
+ [mapstyle.ts:163](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L163)
109
+
110
+ ___
111
+
112
+ ### getVariant
113
+
114
+ β–Έ **getVariant**(`variantType`): [`MapStyleVariant`](MapStyleVariant.md)
115
+
116
+ Get a given variant. If the given type of variant does not exist for this reference style,
117
+ then the most relevant default variant is returned instead
118
+
119
+ #### Parameters
120
+
121
+ | Name | Type |
122
+ | :------ | :------ |
123
+ | `variantType` | `string` |
124
+
125
+ #### Returns
126
+
127
+ [`MapStyleVariant`](MapStyleVariant.md)
128
+
129
+ #### Defined in
130
+
131
+ [mapstyle.ts:199](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L199)
132
+
133
+ ___
134
+
135
+ ### getVariants
136
+
137
+ β–Έ **getVariants**(): [`MapStyleVariant`](MapStyleVariant.md)[]
138
+
139
+ Get the list of variants for this reference style
140
+
141
+ #### Returns
142
+
143
+ [`MapStyleVariant`](MapStyleVariant.md)[]
144
+
145
+ #### Defined in
146
+
147
+ [mapstyle.ts:209](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L209)
148
+
149
+ ___
150
+
151
+ ### hasVariant
152
+
153
+ β–Έ **hasVariant**(`variantType`): `boolean`
154
+
155
+ Check if a given variant type exists for this reference style
156
+
157
+ #### Parameters
158
+
159
+ | Name | Type |
160
+ | :------ | :------ |
161
+ | `variantType` | `string` |
162
+
163
+ #### Returns
164
+
165
+ `boolean`
166
+
167
+ #### Defined in
168
+
169
+ [mapstyle.ts:189](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/mapstyle.ts#L189)
@@ -1,4 +1,4 @@
1
- [MapTiler Client - v1.0.3](../README.md) / ServiceError
1
+ [MapTiler Client - v1.1.0](../README.md) / ServiceError
2
2
 
3
3
  # Class: ServiceError
4
4
 
@@ -39,7 +39,7 @@ Error.constructor
39
39
 
40
40
  #### Defined in
41
41
 
42
- [services/ServiceError.ts:5](https://github.com/maptiler/maptiler-client-js/blob/05ded3a/src/services/ServiceError.ts#L5)
42
+ [services/ServiceError.ts:5](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/services/ServiceError.ts#L5)
43
43
 
44
44
  ## Properties
45
45
 
@@ -49,4 +49,4 @@ Error.constructor
49
49
 
50
50
  #### Defined in
51
51
 
52
- [services/ServiceError.ts:5](https://github.com/maptiler/maptiler-client-js/blob/05ded3a/src/services/ServiceError.ts#L5)
52
+ [services/ServiceError.ts:5](https://github.com/maptiler/maptiler-client-js/blob/64f9493/src/services/ServiceError.ts#L5)
@@ -66,7 +66,7 @@
66
66
  hiDPI: true,
67
67
  width: 1024,
68
68
  height: 2048,
69
- style: 'streets-v2',
69
+ style: maptilerclient.MapStyle.STAGE.DARK,
70
70
  path: [[-9.8905, 36.6274], [-9.8905, 42.3208], [-6.0453, 42.3208], [-6.0453, 36.6274], [-9.8905, 36.6274]],
71
71
  pathStrokeColor: 'red',
72
72
  pathWidth: 4,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maptiler/client",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "Javascript & Typescript wrapper to MapTiler Cloud API",
5
5
  "module": "dist/maptiler-client.mjs",
6
6
  "types": "dist/maptiler-client.d.ts",
package/readme.md CHANGED
@@ -14,7 +14,10 @@
14
14
  <img src="https://img.shields.io/twitter/follow/maptiler?style=social"></img>
15
15
  </p>
16
16
 
17
- # What and why?
17
+ # API Client Library for JavaScript / TypeScript
18
+
19
+ ## What?
20
+
18
21
  The **MapTiler Client JS** exposes a number of handy functions that wrap API call to [MapTiler Cloud API services](https://docs.maptiler.com/cloud/api), such as:
19
22
  - Geocoding forward and reverse
20
23
  - Geolocation from visitor's IP address
@@ -22,8 +25,18 @@ The **MapTiler Client JS** exposes a number of handy functions that wrap API cal
22
25
  - User data fetching as GeoJSON
23
26
  - Static maps of all sorts
24
27
 
28
+ ## Why?
29
+
25
30
  The project is entirely written in TypeScript and all the function arguments are nicely documented and typed.
26
31
 
32
+ - Better developer experience of working with APIs in the code editor - with parameter info, quick info, and member lists.
33
+ - Code completion: reducing typos and other common mistakes
34
+ - Content assist and code hinting providing contextual help
35
+ - Type safety - for higher quality code and testing
36
+ - Backward compatibility: guaranteed on changes to API endpoints
37
+ - Runs: in Node.js or in browser
38
+ - Open source license
39
+
27
40
  > πŸ“£ *__Note:__* If you need *this* API wrapper **AND** a complete SDK to display beautiful interactive maps, then checkout [MapTiler SDK JS](https://github.com/maptiler/maptiler-sdk-js), it contains it all!
28
41
 
29
42
  # Install
@@ -32,7 +45,7 @@ npm install --save @maptiler/client
32
45
  ```
33
46
 
34
47
  # API documentation
35
- In addition to the details and examples provided in this readme, check out the [complete API documentation](docs/README.md)).
48
+ In addition to the details and examples provided in this readme, check out the [complete API documentation](https://maptiler.github.io/maptiler-client-js).
36
49
 
37
50
  # Quick start
38
51
  ```ts
@@ -56,6 +69,8 @@ The [examples](examples/) folder includes are featuring usages for **NodeJS**, *
56
69
  Here is the list of service wrapper functions that are built-in:
57
70
 
58
71
  ## πŸ” Geocoding
72
+ > βœ… Please, use geocoding responses in the context of server-side rendering, hydration or client-side rendering, but do not 🚫 store or redistribute MapTiler Cloud API data. In case of doubt, consult the [terms](https://www.maptiler.com/cloud/terms/#explicitly-prohibited-use) βš–οΈ
73
+
59
74
  ### Forward
60
75
  You want to know the longitude and latitude of a specific place, use the forward geocoding:
61
76
  ```ts
@@ -89,6 +104,8 @@ const result = await maptilerClient.geocoding.forward('paris', {language: [mapti
89
104
  The special language `AUTO` will detect the plateform/browser prefered language.
90
105
 
91
106
  ## πŸ•΅οΈβ€β™‚οΈ Geolocation
107
+ > βœ… Please, use geolocation responses in the context of server-side rendering, hydration or client-side rendering, but do not 🚫 store or redistribute MapTiler Cloud API data. In case of doubt, consult the [terms](https://www.maptiler.com/cloud/terms/#explicitly-prohibited-use) βš–οΈ
108
+
92
109
  The geolocation service provides an accurate location insight of a website visitor using its IP address.
93
110
 
94
111
  There is only a single function:
@@ -100,6 +117,8 @@ const result = await maptilerClient.geolocation.info();
100
117
  Read more about geolocation on our official [API documentation](https://docs.maptiler.com/cloud/api/geolocation/).
101
118
 
102
119
  ## 🌐 Coordinates
120
+ > βœ… Please, use coordinate responses in the context of server-side rendering, hydration or client-side rendering, but do not 🚫 store or redistribute MapTiler Cloud API data. In case of doubt, consult the [terms](https://www.maptiler.com/cloud/terms/#explicitly-prohibited-use) βš–οΈ
121
+
103
122
  If you are already familiar with [epsg.io](https://epsg.io/) (created by MapTiler), then you may find convenient to access the details of more than 10 thousands of coordinate reference systems (CRS) programmatically, as well as transforming coordinates from one system to another!
104
123
 
105
124
  ### Search
@@ -144,6 +163,8 @@ const result = await maptilerClient.data.get('my-dataset-unique-id')
144
163
  Since the result is a GeoJSON, it can easily be added to a `map` with `.addSource()` and `.addLayer()`.
145
164
 
146
165
  ## πŸ—ΊοΈ Static maps
166
+ > βœ… Please, use static maps URLs only from client side `<img>` elements, and do not 🚫 store or redistribute the static map files. In case of doubt, consult the [terms](https://www.maptiler.com/cloud/terms/#explicitly-prohibited-use) βš–οΈ
167
+
147
168
  Maptiler Cloud provides many possibilities for creating static maps as PNG, JPEG or WebP images. They all offer the possibilities to:
148
169
  - Choose from one of the MapTiler style or your own
149
170
  - Add markers with a custom icon (or default icon with custom color)
@@ -153,6 +174,41 @@ Three modes are available: `centered`, `bounded` and `automatic`.
153
174
 
154
175
  > πŸ“£ *__important:__* Contrary to the geolocation/geocoding/coordinates/data service wrappers, the static maps function **does not** perform any query to the MapTiler API, instead they build the image URL. We took this decision because images are most likely going to be displayed in `<img src="path.png"></img>` markups and will naturaly be fetched by the web browser.
155
176
 
177
+ ### Map Styles
178
+ In the following static map functions, the `option` object features a `style` property that can be a string or one of the built-in style shorthand. Here is the full list:
179
+
180
+ - `MapStyle.STREETS`, reference style for navigation and city exploration
181
+ - `MapStyle.STREETS.DARK` (variant)
182
+ - `MapStyle.STREETS.LIGHT` (variant)
183
+ - `MapStyle.STREETS.PASTEL` (variant)
184
+ - `MapStyle.OUTDOOR` reference style for adventure
185
+ - `MapStyle.WINTER` reference style for winter adventure
186
+ - `MapStyle.SATELLITE` reference style satellite and airborne imagery (no variants)
187
+ - `MapStyle.HYBRID` reference style satellite and airborne imagery with labels (no variants)
188
+ - `MapStyle.BASIC` reference style for minimalist design and general purpose
189
+ - `MapStyle.BASIC.DARK` (variant)
190
+ - `MapStyle.BASIC.LIGHT` (variant)
191
+ - `MapStyle.BRIGHT` reference style for high contrast navigation
192
+ - `MapStyle.BRIGHT.DARK` (variant)
193
+ - `MapStyle.BRIGHT.LIGHT` (variant)
194
+ - `MapStyle.BRIGHT.PASTEL` (variant)
195
+ - `MapStyle.TOPO` reference style for topographic study
196
+ - `MapStyle.TOPO.SHINY` (variant)
197
+ - `MapStyle.TOPO.PASTEL` (variant)
198
+ - `MapStyle.TOPO.TOPOGRAPHIQUE` (variant)
199
+ - `MapStyle.VOYAGER` reference style for stylish yet minimalist maps
200
+ - `MapStyle.VOYAGER.DARK` (variant)
201
+ - `MapStyle.VOYAGER.LIGHT` (variant)
202
+ - `MapStyle.VOYAGER.VINTAGE` (variant)
203
+ - `MapStyle.TONER` reference style for very high contrast stylish maps
204
+ - `MapStyle.TONER.BACKGROUND` (variant)
205
+ - `MapStyle.TONER.LITE` (variant)
206
+ - `MapStyle.TONER.LINES` (variant)
207
+ - `MapStyle.OPENSTREETMAP` (reference style, this one does not have any variants)
208
+ - `MapStyle.STAGE`, the perfect style for data visualization, with very little noise
209
+ - `MapStyle.STAGE.DARK` (variant)
210
+ - `MapStyle.STAGE.LIGHT` (variant)
211
+
156
212
  ### Centered static maps
157
213
  This type of map is centered on a longitude-latitude coordinate and the zoom level must also be provided (from `0`: very zoomed out, to `22`: very zoomed in).
158
214
  Note that if a path or markers are provided, the framing of the map will not automatically adapt to include those (use the `automatic` mode for that).
@@ -175,7 +231,7 @@ const imageLink = maptiler.staticMaps.centered(
175
231
  height: 1000,
176
232
 
177
233
  // Map style
178
- style: 'streets-v2',
234
+ style: maptilerClient.MapStyle.OUTDOOR,
179
235
  });
180
236
  ```
181
237
 
@@ -200,7 +256,7 @@ const imageLink = maptiler.staticMaps.bounded(
200
256
  hiDPI: true,
201
257
  width: 2048,
202
258
  height: 2048,
203
- style: 'streets-v2',
259
+ style: maptilerClient.MapStyle.STREETS.DARK,
204
260
 
205
261
  // Extra space that will add around the bounding box, in percentage
206
262
  // (0.1 = 10% is actually the dafault)
@@ -246,7 +302,7 @@ const imageLink = maptiler.staticMaps.automatic({
246
302
  height: 1024 ,
247
303
 
248
304
  // A grey style on which the track will pop!
249
- style: 'streets-v2-light',
305
+ style: maptilerClient.MapStyle.STREETS.LIGHT,
250
306
 
251
307
  // Draw a path with the trackpoints
252
308
  path: trackPoints,
@@ -286,3 +342,6 @@ config.fetch = fetch;
286
342
 
287
343
  // ...
288
344
  ```
345
+
346
+ # Terms and usage limitations
347
+ The data fetched from MapTiler Cloud API, with or without this library, cannot be stored or redistributed in any ways. If you have any doubt about your specific usecase, please consult our [legal terms](https://www.maptiler.com/cloud/terms/) or contact us at **sales@maptiler.com** .
package/src/index.ts CHANGED
@@ -44,6 +44,16 @@ import type {
44
44
 
45
45
  import { ServiceError } from "./services/ServiceError";
46
46
 
47
+ import type { MapStylePreset, MapStyleType } from "./mapstyle";
48
+
49
+ import {
50
+ MapStyleVariant,
51
+ ReferenceMapStyle,
52
+ mapStylePresetList,
53
+ MapStyle,
54
+ styleToStyle,
55
+ } from "./mapstyle";
56
+
47
57
  // Exporting types
48
58
  export type {
49
59
  Position,
@@ -74,6 +84,8 @@ export type {
74
84
  GetDataOptions,
75
85
  GeolocationInfoOptions,
76
86
  GeolocationResult,
87
+ MapStylePreset,
88
+ MapStyleType,
77
89
  };
78
90
 
79
91
  // Exporting classes, objects, functions, etc.
@@ -87,4 +99,9 @@ export {
87
99
  data,
88
100
  staticMaps,
89
101
  LanguageGeocoding,
102
+ MapStyleVariant,
103
+ ReferenceMapStyle,
104
+ mapStylePresetList,
105
+ MapStyle,
106
+ styleToStyle,
90
107
  };