globe.gl 2.24.5 → 2.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,81 @@
1
+ <head>
2
+ <style>
3
+ body { margin: 0; }
4
+
5
+ #time-log {
6
+ position: absolute;
7
+ font-size: 12px;
8
+ font-family: sans-serif;
9
+ padding: 5px;
10
+ border-radius: 3px;
11
+ background-color: rgba(200, 200, 200, 0.1);
12
+ color: lavender;
13
+ bottom: 10px;
14
+ right: 10px;
15
+ }
16
+ </style>
17
+
18
+ <script src="//unpkg.com/three"></script>
19
+ <script src="//unpkg.com/satellite.js/dist/satellite.min.js"></script>
20
+
21
+ <script src="//unpkg.com/globe.gl"></script>
22
+ <!-- <script src="../../dist/globe.gl.js"></script>-->
23
+ </head>
24
+
25
+ <body>
26
+ <div id="chart"></div>
27
+ <div id="time-log"></div>
28
+
29
+ <script>
30
+ const EARTH_RADIUS_KM = 6371; // km
31
+ const SAT_SIZE = 100; // km
32
+ const TIME_STEP = 4 * 1000; // per frame
33
+
34
+ const timeLogger = document.getElementById('time-log');
35
+
36
+ const world = Globe()
37
+ (document.getElementById('chart'))
38
+ .globeImageUrl('//unpkg.com/three-globe/example/img/earth-blue-marble.jpg')
39
+ .objectLat('lat')
40
+ .objectLng('lng')
41
+ .objectAltitude('alt')
42
+ .objectLabel('name');
43
+
44
+ setTimeout(() => world.pointOfView({ altitude: 3.5 }));
45
+
46
+ const satGeometry = new THREE.OctahedronGeometry(SAT_SIZE * world.getGlobeRadius() / EARTH_RADIUS_KM / 2, 0);
47
+ const satMaterial = new THREE.MeshLambertMaterial({ color: 'palegreen', transparent: true, opacity: 0.7 });
48
+ world.objectThreeObject(() => new THREE.Mesh(satGeometry, satMaterial));
49
+
50
+ fetch('../datasets/space-track-leo.txt').then(r => r.text()).then(rawData => {
51
+ const tleData = rawData.split('\n0').map(tle => tle.split('\n'));
52
+ const satData = tleData.map(([name, ...tle]) => ({
53
+ satrec: satellite.twoline2satrec(...tle),
54
+ name: name.split(' ').slice(1).join(' '),
55
+ }));
56
+
57
+ // time ticker
58
+ let time = new Date();
59
+ (function frameTicker() {
60
+ requestAnimationFrame(frameTicker);
61
+
62
+ time = new Date(+time + TIME_STEP);
63
+ timeLogger.innerText = time.toString();
64
+
65
+ // Update satellite positions
66
+ const gmst = satellite.gstime(time);
67
+ satData.forEach(d => {
68
+ const eci = satellite.propagate(d.satrec, time);
69
+ if (eci.position) {
70
+ const gdPos = satellite.eciToGeodetic(eci.position, gmst);
71
+ d.lat = satellite.radiansToDegrees(gdPos.latitude);
72
+ d.lng = satellite.radiansToDegrees(gdPos.longitude);
73
+ d.alt = gdPos.height / EARTH_RADIUS_KM
74
+ }
75
+ });
76
+
77
+ world.objectsData(satData);
78
+ })();
79
+ });
80
+ </script>
81
+ </body>
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "globe.gl",
3
- "version": "2.24.5",
3
+ "version": "2.25.0",
4
4
  "description": "UI component for Globe Data Visualization using ThreeJS/WebGL",
5
5
  "unpkg": "dist/globe.gl.min.js",
6
6
  "jsdelivr": "dist/globe.gl.min.js",
@@ -43,20 +43,20 @@
43
43
  "accessor-fn": "1",
44
44
  "kapsule": "^1.13",
45
45
  "three": ">=0.118 <1",
46
- "three-globe": "^2.21",
46
+ "three-globe": "^2.23",
47
47
  "three-render-objects": "^1.26"
48
48
  },
49
49
  "devDependencies": {
50
- "@babel/core": "^7.16.12",
50
+ "@babel/core": "^7.17.5",
51
51
  "@babel/plugin-proposal-class-properties": "^7.16.7",
52
- "@babel/plugin-proposal-object-rest-spread": "^7.16.7",
52
+ "@babel/plugin-proposal-object-rest-spread": "^7.17.3",
53
53
  "@babel/preset-env": "^7.16.11",
54
54
  "@rollup/plugin-babel": "^5.3.0",
55
55
  "@rollup/plugin-commonjs": "^21.0.1",
56
56
  "@rollup/plugin-node-resolve": "^13.1.3",
57
- "postcss": "^8.4.5",
57
+ "postcss": "^8.4.6",
58
58
  "rimraf": "^3.0.2",
59
- "rollup": "^2.66.1",
59
+ "rollup": "^2.68.0",
60
60
  "rollup-plugin-dts": "^4.1.0",
61
61
  "rollup-plugin-postcss": "^4.0.2",
62
62
  "rollup-plugin-terser": "^7.0.2",