-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update with client lib v1.8.0 to bring elevation (#67)
* ADD client lib v1.8.0 * ADD ready event and Maplibre update
- Loading branch information
1 parent
87568d2
commit 60a7a17
Showing
7 changed files
with
470 additions
and
1,455 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.