-
Notifications
You must be signed in to change notification settings - Fork 331
/
Copy pathindex.html
35 lines (29 loc) · 1.15 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<head>
<style> body { margin: 0; } </style>
<script src="//unpkg.com/globe.gl"></script>
<!--<script src="../../dist/globe.gl.js"></script>-->
</head>
<body>
<div id="globeViz"></div>
<script>
const world = new Globe(document.getElementById('globeViz'))
.globeImageUrl('//unpkg.com/three-globe/example/img/earth-dark.jpg')
.pointOfView({ altitude: 4 }, 5000)
.polygonCapColor(feat => 'rgba(200, 0, 0, 0.6)')
.polygonSideColor(() => 'rgba(0, 100, 0, 0.05)')
.polygonLabel(({ properties: d }) => `
<b>${d.ADMIN} (${d.ISO_A2})</b> <br />
Population: <i>${Math.round(+d.POP_EST / 1e4) / 1e2}M</i>
`);
// Auto-rotate
world.controls().autoRotate = true;
world.controls().autoRotateSpeed = 1.8;
fetch('../datasets/ne_110m_admin_0_countries.geojson').then(res => res.json()).then(countries => {
world.polygonsData(countries.features.filter(d => d.properties.ISO_A2 !== 'AQ'));
setTimeout(() => world
.polygonsTransitionDuration(4000)
.polygonAltitude(feat => Math.max(0.1, Math.sqrt(+feat.properties.POP_EST) * 7e-5))
, 3000);
});
</script>
</body>