Update with client lib v1.8.0 to bring elevation #67
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
The major goal for this version is to update the SDK with the MapTiler Client library v1.8.0. This version brings the lookup/computation of the elevation as well as the math module.
A second objective was to expose all the types that are used as function options, in particular regarding the geocoding. Now, all the TS type definition are properly exposed/routed from the Client lib.
Extra addition: the
ready
event and on.onReadyAsync()
Map method. Those occur afterload
, when all the controls managed by the Map constructor are dealt with, including those with an asynchronous logic. As a result, theready
event is safer to wait for than theload
because it guaranties that the placement of controls added at constructor time is finished and that new controls can be added.Lastly, the dependency to MapLibre GL JS will go from v3.5.2 to v3.6.2 (the latest available at the date of this PR)
Description
The elevation capabilities are available under the
elevation
module. With UMD/CDN, this is available atmaptilersdk.elevation
and with ES modules, this is at:from there, it's possible to call
await elevation.at([lng, let])
or any other batch function available and it will return positions with elevations as[lng, lat, ele]
. There are also functions to batch lookup with GeoJSON payloads that returns exactely the same structure as a clone but with elevated positions.Alongside the
elevation
module, the update to the last Client library is also bringing themath
module. This is a fairly small one but it bring a lot of handy functions for tile ID to positions, wgs84 and mercator lookup, etc. The kind of things we are glad to no longer have to redevelop every single time! Note that this module makes a lot of sense to have in the client library because it's a low dependency headless lib, but in the SDK, some of the math functions will be redundant with what we can find in the MapLibre. Feel free to use the ones you prefer, they are using the same standard types from GeoJSON as input and output and perform the same calculation.The update to the last stable version of MapLibre is only adding bugfixes but it's good practice to stay up to date, especially before the more important v4 to come soon.
Acceptance
Elevation works.
Checklist