Mapbox Map Playground

Offer different options to create a Mapboxgl map

by Yi Xu

HTML

<script src="https://api.tiles.mapbox.com/mapbox-gl-js/v0.43.0/mapbox-gl.js"></script>
<link rel="stylesheet" href="https://api.tiles.mapbox.com/mapbox-gl-js/v0.43.0/mapbox-gl.css">
<html>
<head>
    <meta charset='utf-8' />
    <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
</head>
<body>

<div id='map'></div>

</body>
</html>

CSS

body { margin:0; padding:0; }
        #map { position:absolute; top:0; bottom:0; width:30%; }

JavaScript

var map = new mapboxgl.Map({
    container: 'map', // container id
    style: 'https://roxyi.github.io/basemap_data/style.json', // stylesheet location
    center: [-73.95412,40.729249], // starting position [lng, lat]
    zoom: 12 // starting zoom
});