Built with blockbuilder.org
Created
February 6, 2018 21:18
-
-
Save mastersigat/f1918fc5b16a7e6e035a3ff8b367fb90 to your computer and use it in GitHub Desktop.
#MapboxGL / Cercles gradués
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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: 15, // 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-color': '#D49A66', | |
// Add data-driven styles for circle radius | |
'circle-radius': { | |
property: 'circonferenceencm', | |
type: 'exponential', | |
stops: [ | |
[0, 0], | |
[200, 10] | |
] | |
}, | |
'circle-opacity': 0.8 | |
} | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment