Using a Mapbox GL map

Using MapsGL with Mapbox GL

This example demonstrates using MapsGL with the Mapbox GL (opens in a new tab) mapping library.

<!DOCTYPE html>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>MapsGL SDK - Using MapsGL with Mapbox GL</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="{% $versions.mapbox.current %}/mapbox-gl.css" rel="stylesheet" />
    <script defer src="{% $versions.mapbox.current %}/mapbox-gl.js"></script>
    <script defer src="{% $paths.sdk %}"></script>
        #map {
            height: 600px;
            margin: 30px auto;
            width: 1200px;
<div id="map"></div>
    window.addEventListener('load', () => {
        // create the Mapbox map instance
        const map = new mapboxgl.Map({
			container: 'map',
			style: 'mapbox://styles/mapbox/light-v11',
			center: [-85.5, 40],
			zoom: 3,
            projection: 'mercator'
        // create the account
        const account = new aerisweather.mapsgl.Account('CLIENT_ID', 'CLIENT_SECRET');
        // create the Mapbox Map Controller
        const controller = new aerisweather.mapsgl.MapboxMapController(map, { account });
        controller.on('load', () => {
            // do stuff, like add weather layers