Skip to content

Instantly share code, notes, and snippets.

Created February 11, 2018 13:02
Show Gist options
  • Save anonymous/54872b5379a59b0cee850a112af572b0 to your computer and use it in GitHub Desktop.
Save anonymous/54872b5379a59b0cee850a112af572b0 to your computer and use it in GitHub Desktop.
#MapboxGL / Cercles gradués
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.eyJ1IjoibWFzdGVyc2lnYXQiLCJhIjoiY2loNG9mamxwMHp2dHgxbTBjY2hlb2RteiJ9.dDYKXX9907pbT6sTAJ4fvA';
// Configuration de la carte
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/dark-v9',
center: [-2.55523, 48.1594], // lat/long
zoom: 7, // zoom
pitch: 50, // Inclinaison
bearing: -10 // Rotation
});
// Ajout de données OSM
map.on('load', function () {
map.addSource('Centroides', {
type: 'vector',
url: 'mapbox://ninanoun.83jrmfdl'});
map.addLayer({
"id": 'propcircle',
"type": 'circle',
"source": 'Centroides',
"source-layer": 'communesBZH3-9ahj9b',
"layout": {'visibility': 'visible'},
paint: {
'circle-color': '#D49A66',
// Add data-driven styles for circle radius
'circle-radius': {
property: 'Residences',
type: 'exponential',
stops: [
[10, 1],
[2000, 15]
]
},
'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