Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update with client lib v1.8.0 to bring elevation #67

Merged
merged 2 commits into from
Dec 19, 2023
Merged

Conversation

jonathanlurie
Copy link
Collaborator

@jonathanlurie jonathanlurie commented Dec 14, 2023

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 after load, when all the controls managed by the Map constructor are dealt with, including those with an asynchronous logic. As a result, the ready event is safer to wait for than the load 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 at maptilersdk.elevation and with ES modules, this is at:

import { elevation } from "@maptiler/sdk";

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 the math 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

  • I have added relevant info to the CHANGELOG.md

Copy link
Member

@petrsloup petrsloup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@petrsloup petrsloup merged commit 60a7a17 into main Dec 19, 2023
1 check passed
@petrsloup petrsloup deleted the dev-v1.2.1 branch December 19, 2023 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants