Skip to content

Instantly share code, notes, and snippets.

@mastersigat
Created February 11, 2018 20:18
Show Gist options
  • Save mastersigat/64af1a273f155037214d96406cb4777a to your computer and use it in GitHub Desktop.
Save mastersigat/64af1a273f155037214d96406cb4777a to your computer and use it in GitHub Desktop.
#Template / Extrusion MapboxGL
license: mit
<!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://api.tiles.mapbox.com/mapbox-gl-js/v0.42.2/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.42.2/mapbox-gl.css' rel='stylesheet' />
<style>
#map {width: 100%; height:800px;}
</style>
</head>
<body>
<div id='map'> </div>
<script>
// Configuration carte
mapboxgl.accessToken = 'pk.eyJ1IjoibmluYW5vdW4iLCJhIjoiY2pjdHBoZGlzMnV4dDJxcGc5azJkbWRiYSJ9.o4dZRrdHcgVEKCveOXG1YQ';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/ninanoun/cj975wxdj108c2rnxsem0rbfd',
center: [-1.7023, 48.05], // starting position [lng, lat]
zoom: 12,
pitch : 0
});
// Config data
map.on('style.load', function() {
// Ajout carreaux
map.addSource('Carro', {
'type': 'vector',
url: 'mapbox://ninanoun.2n5gi217'});
// Carreaux
map.addLayer({
'id': 'extrude',
'type': 'line',
'source': 'Carro',
'source-layer': 'karook-dcnhdj',
'layout': {'visibility': 'visible'},
'paint': {'line-color': '#FFFFFF', 'line-width': 0.5}
});
});
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment