Skip to content

Instantly share code, notes, and snippets.

@FergusDevelopmentLLC
Last active March 8, 2024 18:26
Show Gist options
  • Save FergusDevelopmentLLC/6b515fcc2b7c6479d9c31059140eb611 to your computer and use it in GitHub Desktop.
Save FergusDevelopmentLLC/6b515fcc2b7c6479d9c31059140eb611 to your computer and use it in GitHub Desktop.
<!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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment