@maptiler/client 3.1.0-rc.1 β 3.1.0-rc.2
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/dist/maptiler-client.cjs +91 -13
- package/dist/maptiler-client.cjs.map +1 -1
- package/dist/maptiler-client.d.ts +2 -9
- package/dist/maptiler-client.min.mjs +1 -1
- package/dist/maptiler-client.mjs +18 -13
- package/dist/maptiler-client.mjs.map +1 -1
- package/package.json +2 -1
- package/readme.md +8 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maptiler/client",
|
|
3
|
-
"version": "3.1.0-rc.
|
|
3
|
+
"version": "3.1.0-rc.2",
|
|
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",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"vitest": "^0.34.6"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
+
"@googlemaps/polyline-codec": "^1.0.28",
|
|
83
84
|
"quick-lru": "^7.0.0"
|
|
84
85
|
}
|
|
85
86
|
}
|
package/readme.md
CHANGED
|
@@ -23,7 +23,7 @@ The project is entirely written in TypeScript and all the function arguments are
|
|
|
23
23
|
[](https://www.npmjs.com/package/@maptiler/client) 
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
-
π [Documentation](https://docs.maptiler.com/
|
|
26
|
+
π [Documentation](https://docs.maptiler.com/cloud/api/) π¦ [NPM Package](https://www.npmjs.com/package/@maptiler/client) π [Website](https://docs.maptiler.com/client-js/) π [Get API Key](https://cloud.maptiler.com/account/keys/)
|
|
27
27
|
|
|
28
28
|
---
|
|
29
29
|
|
|
@@ -106,7 +106,7 @@ The [examples](examples/) folder includes usages for **NodeJS**, **browser with
|
|
|
106
106
|
|
|
107
107
|
For detailed guides, API reference, and advanced examples, visit our comprehensive documentation:
|
|
108
108
|
|
|
109
|
-
[API documentation](https://docs.maptiler.com/
|
|
109
|
+
[API documentation](https://docs.maptiler.com/cloud/api/)
|
|
110
110
|
|
|
111
111
|
### Easy access to MapTiler API
|
|
112
112
|
|
|
@@ -116,6 +116,8 @@ Here is the list of service wrapper functions that are built-in:
|
|
|
116
116
|
|
|
117
117
|
> β
Please, use geocoding functions only from client-side (browser) and 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) βοΈ
|
|
118
118
|
|
|
119
|
+
Read more about geocoding, including forward, reverse, batch, and usage examples, in our [Geocoding API documentation](https://docs.maptiler.com/cloud/api/geocoding/).
|
|
120
|
+
|
|
119
121
|
#### Forward
|
|
120
122
|
|
|
121
123
|
You want to know the longitude and latitude of a specific place, use the forward geocoding:
|
|
@@ -128,8 +130,6 @@ You can provide some options, such as:
|
|
|
128
130
|
- one of more languages to get the results into
|
|
129
131
|
- a bounding geo box, to restrict the search to a given window
|
|
130
132
|
|
|
131
|
-
Read more about forward geocoding, as well as feature ID query and batch forward geocoding, on our [official documentation](https://docs.maptiler.com/client-js/geocoding/#forward).
|
|
132
|
-
|
|
133
133
|
#### Reverse
|
|
134
134
|
|
|
135
135
|
You want to know the name of a place, given a longitude-latitude? Use the reverse geocoding:
|
|
@@ -139,8 +139,6 @@ const result = await maptilerClient.geocoding.reverse([6.249638, 46.402056]);
|
|
|
139
139
|
```
|
|
140
140
|
The same option object as the forward geocoding can be provided.
|
|
141
141
|
|
|
142
|
-
Read more about reverse geocoding on our [official documentation](https://docs.maptiler.com/client-js/geocoding/#reverse).
|
|
143
|
-
|
|
144
142
|
#### Language
|
|
145
143
|
|
|
146
144
|
For both *forward* and *reverse* geocoding, this library provides a list of supported languages as shorthands that include [ISO language codes](https://en.wikipedia.org/wiki/ISO_639-1). The result will be provided in multiple languages if the `language` options are an array:
|
|
@@ -165,8 +163,6 @@ There is only a single function:
|
|
|
165
163
|
const result = await maptilerClient.geolocation.info();
|
|
166
164
|
```
|
|
167
165
|
|
|
168
|
-
Read more about geolocation on our [official documentation](https://docs.maptiler.com/client-js/geolocation/).
|
|
169
|
-
|
|
170
166
|
### π Coordinates
|
|
171
167
|
|
|
172
168
|
If you are already familiar with [epsg.io](https://epsg.io/) (created by MapTiler), then you may find it 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!
|
|
@@ -184,8 +180,6 @@ const resultD = await maptilerClient.coordinates.search('code:4326', {transforma
|
|
|
184
180
|
|
|
185
181
|
The `transformations` options retrieve a lot more details about the CRS that MapTiler API is able to transform to/from than just their IDs.
|
|
186
182
|
|
|
187
|
-
Read more about searching coordinate systems in our [official documentation](https://docs.maptiler.com/client-js/coordinates/#search).
|
|
188
|
-
|
|
189
183
|
#### Transform
|
|
190
184
|
|
|
191
185
|
Transforming a couple of coordinates from one system to another can be challenging, for example, most countries have their own official system, yet web mapping tools are more often than not exclusive to [WGS84](https://epsg.io/4326).
|
|
@@ -202,8 +196,6 @@ const resultA = await maptilerClient.coordinates.transform([1, 45], {targetCrs:
|
|
|
202
196
|
const resultB = await maptilerClient.coordinates.transform([[10, 48], [1, 45]], {targetCrs: 9793})
|
|
203
197
|
```
|
|
204
198
|
|
|
205
|
-
Read more about transforming coordinates on our [official documentation](https://docs.maptiler.com/client-js/coordinates/#transform).
|
|
206
|
-
|
|
207
199
|
### π½ Data
|
|
208
200
|
|
|
209
201
|
MapTiler Cloud give its users the possibility to [upload and create data](https://cloud.maptiler.com/data/), manually with a user interface or by uploading a GPX, GeoJSON, KML or shp file. A unique ID is associated with each dataset so that we can later on access it programmatically to retrieve a GeoJSON equivalent of it:
|
|
@@ -215,8 +207,6 @@ const result = await maptilerClient.data.get('my-dataset-unique-id')
|
|
|
215
207
|
|
|
216
208
|
Since the result is a GeoJSON, it can easily be added to a `map` with `.addSource()` and `.addLayer()`.
|
|
217
209
|
|
|
218
|
-
Read more about fetching your own data on our [official documentation](https://docs.maptiler.com/client-js/data/).
|
|
219
|
-
|
|
220
210
|
### πΊοΈ Static maps
|
|
221
211
|
|
|
222
212
|
> β
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) βοΈ
|
|
@@ -298,7 +288,7 @@ const imageLink = maptilerClient.staticMaps.centered(
|
|
|
298
288
|
});
|
|
299
289
|
```
|
|
300
290
|
|
|
301
|
-
Read more about centered static maps
|
|
291
|
+
Read more about centered static maps in our official [Static maps API documentation](https://docs.maptiler.com/cloud/api/static-maps/#center-based-image).
|
|
302
292
|
|
|
303
293
|
#### Bounded static maps
|
|
304
294
|
|
|
@@ -408,8 +398,6 @@ const elevatedPosition = await maptilerClient.elevation.at(montBlancPeak);
|
|
|
408
398
|
```
|
|
409
399
|
The returned value is also a *GeoJSON* `Position` array, but with three elements: `[lng, lat, elevation]`.
|
|
410
400
|
|
|
411
|
-
Read more about elevation lookup for a single location in our [official documentation](https://docs.maptiler.com/client-js/elevation/#at).
|
|
412
|
-
|
|
413
401
|
#### Batch mode
|
|
414
402
|
|
|
415
403
|
```ts
|
|
@@ -431,8 +419,6 @@ const peaks: Position[] = [
|
|
|
431
419
|
const elevatedPeaks = await maptilerClient.elevation.batch(peaks);
|
|
432
420
|
```
|
|
433
421
|
|
|
434
|
-
Read more about elevation lookup for a batch of locations in our [official documentation](https://docs.maptiler.com/client-js/elevation/#batch).
|
|
435
|
-
|
|
436
422
|
#### From a GeoJSON LineString
|
|
437
423
|
|
|
438
424
|
In the *GeoJSON* LineString case, it clones the entire structure and the positions arrays of the clone will contain three elements: `[lng, lat, elevation]`. The original LineString is not mutated nor pointed at.
|
|
@@ -451,8 +437,6 @@ const someElevatedLineString = await maptilerClient.elevation.fromLineString(som
|
|
|
451
437
|
// someElevatedLineString is also of type LineString
|
|
452
438
|
```
|
|
453
439
|
|
|
454
|
-
Read more about elevation lookup for a `LineString` in our [official documentation](https://docs.maptiler.com/client-js/elevation/#linestring).
|
|
455
|
-
|
|
456
440
|
#### From a GeoJSON MultiLineString
|
|
457
441
|
|
|
458
442
|
In the *GeoJSON* MultiLineString case, it clones the entire structure and the positions arrays of the clone will contain three elements: `[lng, lat, elevation]`. The original MultiLineString is not mutated nor pointed at.
|
|
@@ -475,8 +459,6 @@ const someElevatedMultiLineString = await maptilerClient.elevation.fromMultiLine
|
|
|
475
459
|
// someElevatedMultiLineString is also of type MultiLineString
|
|
476
460
|
```
|
|
477
461
|
|
|
478
|
-
Read more about elevation lookup for a `MultiLineString` in our [official documentation](https://docs.maptiler.com/client-js/elevation/#multilinestring).
|
|
479
|
-
|
|
480
462
|
#### Caching
|
|
481
463
|
|
|
482
464
|
In order to increase performance while reducing unnecessary elevation data fetching, the elevation tiles are cached. This is particularly important for the LineString and MultiLineString lookups because GeoJSON data are likely to come from a recorded or planned route, where position points are very close to one another.
|
|
@@ -521,13 +503,11 @@ const tileXY = maptilerClient.math.wgs84ToTileIndex(montBlancPeakWgs84, 14);
|
|
|
521
503
|
// and many more!
|
|
522
504
|
```
|
|
523
505
|
|
|
524
|
-
Please find out more about the math package in our [official documentation](https://docs.maptiler.com/client-js/math).
|
|
525
|
-
|
|
526
506
|
<br>
|
|
527
507
|
|
|
528
508
|
## π¬ Support
|
|
529
509
|
|
|
530
|
-
- π [Documentation](https://docs.maptiler.com/
|
|
510
|
+
- π [Documentation](https://docs.maptiler.com/cloud/api/) - Comprehensive guides and API reference
|
|
531
511
|
- βοΈ [Contact us](https://maptiler.com/contact) - Get in touch or submit a request
|
|
532
512
|
- π¦ [Twitter/X](https://twitter.com/maptiler) - Follow us for updates
|
|
533
513
|
|
|
@@ -566,6 +546,6 @@ The data fetched from MapTiler Cloud API, with or without this library, cannot b
|
|
|
566
546
|
<p align="center"> π Made with love by the <a href="https://www.maptiler.com/">MapTiler</a> team <br />
|
|
567
547
|
<p align="center">
|
|
568
548
|
<a href="https://docs.maptiler.com/client-js/">Website</a> β’
|
|
569
|
-
<a href="https://docs.maptiler.com/
|
|
549
|
+
<a href="https://docs.maptiler.com/cloud/api/">Documentation</a> β’
|
|
570
550
|
<a href="https://github.com/maptiler/maptiler-client-js">GitHub</a>
|
|
571
|
-
</p>
|
|
551
|
+
</p>
|