Skip to content

Instantly share code, notes, and snippets.

@FergusDevelopmentLLC
Last active March 28, 2020 00:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FergusDevelopmentLLC/d5c3a17ccffae36b68dae215f8c79887 to your computer and use it in GitHub Desktop.
Save FergusDevelopmentLLC/d5c3a17ccffae36b68dae215f8c79887 to your computer and use it in GitHub Desktop.
h3 Hexagon Basemap
license: mit
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.3.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.3.1/mapbox-gl.css' rel='stylesheet' />
<style>
body {
margin: 0;
padding: 0;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<div id='map'>
</div>
<script>
// get bounding box: http://bboxfinder.com
let mapBounds = [-127.529297, 23.805450, -65.478516, 50.401515];//Southwest corner, Northeast corner
mapboxgl.accessToken = 'pk.eyJ1Ijoid2lsbGNhcnRlciIsImEiOiJjamV4b2g3Z2ExOGF4MzFwN3R1dHJ3d2J4In0.Ti-hnuBH8W4bHn7k6GCpGw';
let map = new mapboxgl.Map({
container: 'map',
style: `mapbox://styles/willcarter/ck0772sbl01yx1cnro5iwsj8b`,
center: [(mapBounds[0] + mapBounds[2]) / 2, (mapBounds[1] + mapBounds[3]) / 2],
zoom: 3
});
map.addControl(new mapboxgl.NavigationControl())
map.on('zoomend', () => {
});
</script>
</body>
</html>
<!-- https://blockbuilder.org/FergusDevelopmentLLC/d5c3a17ccffae36b68dae215f8c79887 -->
<!-- http://bl.ocks.org/FergusDevelopmentLLC/d5c3a17ccffae36b68dae215f8c79887 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment