Skip to content

Instantly share code, notes, and snippets.

@mastersigat
Created February 6, 2018 21:19
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 mastersigat/7512cca05b9f6aec0dca28c8ff703d92 to your computer and use it in GitHub Desktop.
Save mastersigat/7512cca05b9f6aec0dca28c8ff703d92 to your computer and use it in GitHub Desktop.
#MapboxGL / Graduation2
license: mit
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>MapboxGL</title>
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.44.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.44.0/mapbox-gl.css' rel='stylesheet' />
<style>
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id='map'></div>
<script>
// AccesToken
mapboxgl.accessToken = 'pk.eyJ1IjoibmluYW5vdW4iLCJhIjoiY2pjdHBoZGlzMnV4dDJxcGc5azJkbWRiYSJ9.o4dZRrdHcgVEKCveOXG1YQ';
// Configuration de la carte
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/ninanoun/ciytbjeef002u2sppd5xvl0q2',
center: [2.34, 48.9], // lat/long
zoom: 13, // zoom
pitch: 50, // Inclinaison
bearing: -10 // Rotation
});
// Ajout de données OSM
map.on('load', function () {
map.addSource('Arrets', {
type: 'vector',
url: 'mapbox://ninanoun.6f7y97sy'});
map.addLayer({
'id': 'Arrets',
'type': 'circle',
'source': 'Arrets',
'source-layer': 'arbres-aqwrsg',
'layout': {'visibility': 'visible'},
'paint': {
'circle-radius': {
'base': 1.5,
'stops': [[13, 2], [22, 60]]
},
'circle-color': {
property: 'hauteurenm',
type: 'exponential',
stops: [[0, '#edf8e9'],[5, '#c7e9c0'], [10, '#a1d99b'], [15, '#74c476'], [20, '#006d2c']]
}
}
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment