Created
July 19, 2020 20:48
-
-
Save markmarkoh/8f6988353e43a8bd78be7b61c42e8236 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// load the h3 json | |
fetch('hexed.json') | |
.then(r => r.json()) | |
.then(data => { | |
// create a hex layer | |
const hexLayer = new deck.H3HexagonLayer({ | |
id: 'h3-hex', | |
data: data, | |
pickable: false, | |
coverage: 0.9, | |
elevationScale: 50, | |
extruded: true, | |
opacity: 0.3, | |
getHexagon: d => d.hex, | |
getElevation: d => d.count, | |
getFillColor: d => [255, (1 - d.count / 500) * 255, 0] | |
}); | |
map.setProps({ | |
layers: [hexLayer] | |
}) | |
}) | |
// create map | |
const map = new deck.DeckGL({ | |
mapboxApiAccessToken: 'pk.eyJ1IjoidGhvci1tYXJrIiwiYSI6ImNrY3IzbnpxMzBnc3QyeXBkZmFicHhhNXQifQ.levs2UY_u0y9PcCLKJIpsA', | |
mapStyle: 'mapbox://styles/mapbox/outdoors-v11', | |
initialViewState: { | |
longitude: 106.65, | |
latitude: 11.8, | |
zoom: 6.5, | |
pitch:60 | |
}, | |
controller: true | |
}) | |
This file contains hidden or 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> | |
<title>US Forces bombing map by volume</title> | |
<script src="https://unpkg.com/h3-js"></script> | |
<script src="https://unpkg.com/deck.gl@latest/dist.min.js"></script> | |
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.53.0/mapbox-gl.js'></script> | |
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.53.0/mapbox-gl.css' rel='stylesheet' /> | |
<style type="text/css"> | |
body { | |
width: 100vw; | |
height: 100vh; | |
margin: 0; | |
</style> | |
</head> | |
<body> | |
<script src="index.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment