Skip to content

Instantly share code, notes, and snippets.

@maning
Created October 28, 2016 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save maning/f65adf9898791d140160383dbd3fe0cf to your computer and use it in GitHub Desktop.
Save maning/f65adf9898791d140160383dbd3fe0cf to your computer and use it in GitHub Desktop.
<!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.26.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.26.0/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.eyJ1IjoibWFuaW5nIiwiYSI6IlhjWGNfdTQifQ.ras0nImWG638BCDSxU8bqw';
var map = new mapboxgl.Map({
style: 'mapbox://styles/mapbox/light-v9',
center: [-122.4027,37.7927],
zoom: 16,
pitch: 45,
bearing: -17.6,
container: 'map'
});
// SF Lidar data of buildings and trees
//
map.on('load', function() {
map.addSource('sf-lidar', {
type: 'vector',
url: 'mapbox://maning.sf-lidar'
});
map.addLayer({
'id': 'sf-lidar',
'source': 'sf-lidar',
'source-layer': 'L2014_SF_TreeBldg1m_toInt_vectgeojson',
'filter': [">=", "DN", 1],
'type': 'fill',
'minzoom': 16,
'paint': {
'fill-color': '#aaa',
'fill-extrude-height': {
'type': 'identity',
'property': 'DN'
},
'fill-opacity': .4
}
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment