UNPKG

globe.gl

Version:

UI component for Globe Data Visualization using ThreeJS/WebGL

27 lines (24 loc) 864 B
<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> fetch('../datasets/ne_110m_admin_0_countries.geojson').then(res => res.json()).then(countries => { const world = Globe() .globeImageUrl('//unpkg.com/three-globe/example/img/earth-dark.jpg') .hexPolygonsData(countries.features) .hexPolygonResolution(3) .hexPolygonMargin(0.3) .hexPolygonColor(() => `#${Math.round(Math.random() * Math.pow(2, 24)).toString(16).padStart(6, '0')}`) .hexPolygonLabel(({ properties: d }) => ` <b>${d.ADMIN} (${d.ISO_A2})</b> <br /> Population: <i>${d.POP_EST}</i> `) (document.getElementById('globeViz')) }); </script> </body>