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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
### Bug Fixes
### Others

## 1.2.1
### New Features
- Elevation lookup at `maptilersdk.elevation` with the function `.at()`, `.batch()` and for geojson payloads. From the update of the MapTiler Client library
- the new `ready` event. Called only once after `load` and wait for all the controls managed by the Map constructor to be dealt with (as one relies on async logic)
- the new Map lifecycle method `.onReadyAsync()` corresponding to a promise-based equivalent of the the `ready` event.
### Bug Fixes
- The index now exposes the geocoding option types from the Client library
### Others
- Update of the Maptiler Client library to v1.8.0 that brings the elevation and math module
- Update with the last version of MapLibre GL JS (v3.6.2)

## 1.2.0
### New Features
- Added the Minimap control https://github.com/maptiler/maptiler-sdk-js/pull/54
Expand Down
60 changes: 60 additions & 0 deletions demos/readyevent.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<html>
<head>
<title>MapTiler JS SDK example</title>
<style>
html, body {
margin: 0;
}

#map-container {
position: absolute;
width: 100vw;
height: 100vh;
background: radial-gradient(circle, rgb(186 226 255) 5%, rgb(0 100 159) 98%);
}

#style-picker-container {
position: absolute;
z-index: 2;
margin: 10px;
}

</style>

<link rel="stylesheet" href="../dist/maptiler-sdk.css">
</head>

<body>
<div id="map-container"></div>
<script src ="../dist/maptiler-sdk.umd.js"></script>

<script>
maptilersdk.config.apiKey = "YOUR_API_KEY";

const map = new maptilersdk.Map({
container: document.getElementById("map-container"),
// style: maptilersdk.MapStyle.OUTDOOR,
hash: true,
maptilerLogo: true,
});

/*
* The "ready" event happens only once, after the "load" event when all the controls that can be configured from
* the constructor are dealt with. The logo control can be enforced depending on the type of MapTiler Cloud account,
* and this is addressed with an asynchronous request. Because of this, the controls that can be added from the constructor
* are added in an asynchronous fashion.
* As a result, later on adding a custom control from within the "load" event callback does not guarrantee that these
* first async controls are done added and the placement of the new control may be be stacked in the wrong order.
*
* The "ready" event guarantees the placemtn order of controls added later on.
*/
map.on("load", async (e) => {
console.log(e);
const scaleControl = new maptilersdk.ScaleControl();
map.addControl(scaleControl, "bottom-left")
})


</script>
</body>
</html>
Loading