Built with blockbuilder.org
Last active
February 5, 2017 20:29
-
-
Save renecnielsen/3491b1870b5f2b9ad68976f1e677f452 to your computer and use it in GitHub Desktop.
fresh block
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></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.32.1/mapbox-gl.js'></script> | |
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.32.1/mapbox-gl.css' rel='stylesheet' /> | |
<style> | |
body { margin:0; padding:0; } | |
#map { position:absolute; top:0; bottom:0; width:100%; } | |
</style> | |
</head> | |
<body> | |
<div id='map'></div> | |
<script> | |
mapboxgl.accessToken = 'pk.eyJ1IjoicmNuIiwiYSI6Img2bS1ZTzAifQ.5JQpWlniPX4Y7wX_wn0F0w'; | |
var map = new mapboxgl.Map({ | |
container: 'map', | |
style: 'mapbox://styles/rcn/ciyt1qkl900202rqm6yg72vhb', | |
zoom: 1.2, | |
center: [1.497115, 25.782166] | |
}); | |
map.on('load', function () { | |
map.addLayer({ | |
'id': 'name', | |
'type': 'circle', | |
'source': { | |
type: 'vector', | |
url: 'rcn.ciyt0ugn0000i2wo3ftaazahb-4ukim' | |
}, | |
'source-layer': 'Regional_IMs', | |
'paint': { | |
// make circles larger as the user zooms from z12 to z22 | |
'circle-radius': { | |
'base': 1.75, | |
'stops': [[12, 2], [22, 180]] | |
}, | |
// color circles by ethnicity, using data-driven styles | |
'circle-color': { | |
property: 'im', | |
type: 'categorical', | |
stops: [ | |
['Yes', '#fbb03b'], | |
['No', '#223b53']] | |
} | |
} | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment