Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Last active March 25, 2021 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThomasG77/2bcdaef08b79546bbb4bacd0867577fd to your computer and use it in GitHub Desktop.
Save ThomasG77/2bcdaef08b79546bbb4bacd0867577fd to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Display a map on a webpage</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<link href="https://api.mapbox.com/mapbox-gl-js/v1.13.1/mapbox-gl.css" rel="stylesheet">
<script src="https://api.mapbox.com/mapbox-gl-js/v1.13.1/mapbox-gl.js"></script>
<style>
body { margin: 0; padding: 0; }
#mapboxgl { position: absolute; top: 0; bottom: 0; width: 100%; }
</style>
</head>
<body>
<div id="mapboxgl"></div>
<script>
this.map = new mapboxgl.Map({
container: 'mapboxgl',
style: {
version: 8,
sources: {},
layers: []
}
});
this.map.setCenter({
lng: 144,
lat: -37
});
this.map.setZoom(15);
console.log(this.map.getCenter(), this.map.getZoom());
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment