S2 DOCS

Display a Map

This example uses S2MapsGL object to display a map.

vanilla
vanilla.html
react
react.jsx
vue
app.vue
svelte
app.svelte
svelte
style.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Display a map</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://s2maps.io/s2maps-gpu/v0.10.0/s2maps-gpu.min.js"></script>
<link rel="stylesheet" href="https://s2maps.io/s2maps-gpu/v0.10.0/s2maps-gpu.min.css">
<style>
  body { margin: 0; padding: 0; }
  #map { position: absolute; top: 0; bottom: 0; width: 100%; }
</style>
</head>
<body>
<div id="map"></div>
<script>
  // create access token
  const apiKey = 'INSERT_YOUR_API_KEY_HERE'
  // grab container div
  const container = document.getElementById('map')
  // setup map style
  const style = { ... }
  // create the map
  new S2Map({ style, apiKey, container })
</script>

</body>
</html>