Built with blockbuilder.org
Created
February 11, 2018 13:18
-
-
Save mastersigat/b2d09221e018183559391b1f828e5547 to your computer and use it in GitHub Desktop.
#MapboxGL / Catégorisation de données
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.89], // lat/long | |
zoom: 16, // zoom | |
pitch: 50, // Inclinaison | |
bearing: -10 // Rotation | |
}); | |
// Ajout de données des arbres | |
map.on('load', function () { | |
map.addSource('Arrets', { | |
type: 'vector', | |
url: 'mapbox://ninanoun.6f7y97sy'}); | |
// Mis en forme des types d'arbres | |
map.addLayer({ | |
'id': 'Arrets', | |
'type': 'circle', | |
'source': 'Arrets', | |
'source-layer': 'arbres-aqwrsg', | |
'layout': {'visibility': 'visible'}, | |
'paint': { | |
'circle-radius': { | |
'base': 1.15, | |
'stops': [[13, 1], [22, 18]]}, | |
'circle-color': [ | |
'match', | |
['get', 'domanialite'], | |
'Alignement', '#fbb03b', | |
'Jardin', '#223b53', | |
'CIMETIERE', '#e55e5e', | |
'DASCO', '#3bb2d0', | |
/* other */ '#ccc'] | |
} | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment