Skip to content

Instantly share code, notes, and snippets.

@BenjaminRosell
Forked from anonymous/fiddle.html
Created March 15, 2018 17:18
Show Gist options
  • Save BenjaminRosell/69a3ed77fe7732c4ab1a39241d17860a to your computer and use it in GitHub Desktop.
Save BenjaminRosell/69a3ed77fe7732c4ab1a39241d17860a to your computer and use it in GitHub Desktop.
Ile Verte + Video (source: https://jsfiddle.net/fh2x0jwu/30/)
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Add a raster tile source</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.44.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.44.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>
mapboxgl.accessToken = 'pk.eyJ1IjoiYmVuamFtaW5yb3NlbGwiLCJhIjoiY2lxcHFwc3ltMDJqdWdzamZpdTFsemp2YiJ9.dGE3qe8fy-GbI6RSRPZnTg';
var map = new mapboxgl.Map({
container: 'map', // container id
style: {
"version": 8,
"sources": {
"verte": {
"type": "raster",
"url": "mapbox://benjaminrosell.52rcajil",
"tileSize": 256
},
"background" : {
"type": "raster",
"url" : "mapbox://mapbox.satellite",
"tileSize": 256
},
"video": {
"type": "video",
"urls": ["https://www.mapbox.com/drone/video/drone.mp4", "https://www.mapbox.com/drone/video/drone.webm"],
"coordinates": [
[-73.50296391201019, 45.56238816766053],
[-73.50167645168304, 45.56410183312965],
[-73.50009394836426, 45.563391708549425],
[-73.50123120498657, 45.56161849366671]
]
}
},
"layers": [{
"id": "background",
"type": "raster",
"source": "background",
"minzoom": 0,
"maxzoom": 22
}, {
"id": "simple-tiles",
"type": "raster",
"source": "verte",
"minzoom": 0,
"maxzoom": 22
}, {
"id": "video",
"type": "raster",
"source": "video"
}]
},
center: [-73.50, 45.562], // starting position
zoom: 14 // starting zoom
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment