spacemap 0.1.17 → 0.1.19
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.
- package/README.md +19 -20
- package/dist/spacemap.iife.js +223 -152
- package/dist/spacemap.js +223 -152
- package/index.d.ts +45 -15
- package/index.js +2673 -192
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# spacemap
|
|
2
2
|
|
|
3
3
|
The map of the Solar System from [spacemap.co](https://spacemap.co), on your
|
|
4
|
-
website!
|
|
5
|
-
|
|
4
|
+
website! Also available: flat maps, 360 panoramas from the surface, and diagrams
|
|
5
|
+
of the solar systems and satellite systems.
|
|
6
6
|
|
|
7
7
|
Distances are kilometres and angles are degrees throughout. Objects are named
|
|
8
|
-
by their export id
|
|
8
|
+
by their export id: `naif-399` for Earth, `spkid-20000004` for Vesta,
|
|
9
9
|
`norad_satcat-25544` for the ISS.
|
|
10
10
|
|
|
11
|
-
No key
|
|
11
|
+
No key or quota for now.
|
|
12
12
|
|
|
13
13
|
## Licensing
|
|
14
14
|
|
|
@@ -24,20 +24,14 @@ the SDK draws only what a page may use:
|
|
|
24
24
|
- **Non-commercial** imagery and models are licensed for educational and
|
|
25
25
|
non-commercial use: the Uranus map, the Huygens descent panorama of Titan,
|
|
26
26
|
and the models of a few craft, most of them Soviet (Buran, Vostok, Lunokhod,
|
|
27
|
-
Salyut 1).
|
|
27
|
+
Salyut 1). These can be turned on, for non-commmercial projects only, with:
|
|
28
28
|
|
|
29
29
|
```js
|
|
30
30
|
const map = await createMap({ container: '#map', includeNonCommercial: true });
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
Asking for it is accepting its terms, and the credit line naming each author
|
|
34
|
-
is part of those terms.
|
|
35
|
-
colour, the Huygens stop is a place on Titan with no panorama to open, and
|
|
36
|
-
those craft stay markers with no model. Mir is the exception: it has an open
|
|
37
|
-
model too, and the map draws that one.
|
|
38
|
-
|
|
39
|
-
- **Site-only** imagery is licensed to spacemap.co alone and never reaches the
|
|
40
|
-
SDK.
|
|
34
|
+
is part of those terms. Do not hide it.
|
|
41
35
|
|
|
42
36
|
## Getting it
|
|
43
37
|
|
|
@@ -47,7 +41,7 @@ your page:
|
|
|
47
41
|
```html
|
|
48
42
|
<div id="map" style="height: 500px"></div>
|
|
49
43
|
<script type="module">
|
|
50
|
-
import { createMap } from 'https://cdn.jsdelivr.net/npm/spacemap@0.1.
|
|
44
|
+
import { createMap } from 'https://cdn.jsdelivr.net/npm/spacemap@0.1.19/dist/spacemap.js';
|
|
51
45
|
const map = await createMap({ container: '#map' });
|
|
52
46
|
</script>
|
|
53
47
|
```
|
|
@@ -86,13 +80,15 @@ const map = await createMap({
|
|
|
86
80
|
|
|
87
81
|
```js
|
|
88
82
|
await map.flyTo({ body: 'naif-599' }); // fly, framing it for you
|
|
89
|
-
map.jumpTo({ body: 'naif-599', distanceKm: 2e6 }); // no flight
|
|
90
|
-
map.jumpTo({ body: 'naif-399', facing: 'naif-10', elevationDeg: 30 });
|
|
83
|
+
await map.jumpTo({ body: 'naif-599', distanceKm: 2e6 }); // no flight
|
|
84
|
+
await map.jumpTo({ body: 'naif-399', facing: 'naif-10', elevationDeg: 30 });
|
|
91
85
|
map.getCamera(); // { body, lat, lon, distanceKm }
|
|
92
86
|
```
|
|
93
87
|
|
|
94
|
-
`flyTo` resolves when the flight lands
|
|
95
|
-
|
|
88
|
+
`flyTo` resolves when the flight lands, and `jumpTo` one frame after the camera
|
|
89
|
+
is in its place. Both load a body the map does not hold yet. What a target
|
|
90
|
+
leaves out the map frames itself, so `{ body }` alone is the ordinary way to
|
|
91
|
+
move.
|
|
96
92
|
|
|
97
93
|
Clicking a named surface feature reports it; `panTo` turns to one without
|
|
98
94
|
travelling:
|
|
@@ -141,15 +137,18 @@ map was opened on a date.
|
|
|
141
137
|
map.clock.pause();
|
|
142
138
|
map.clock.setTimeScale(86400); // a day a second
|
|
143
139
|
map.clock.toggleDirection();
|
|
144
|
-
map.clock.setDate(new Date('2035-06-01'));
|
|
140
|
+
await map.clock.setDate(new Date('2035-06-01'));
|
|
145
141
|
map.clock.now();
|
|
146
142
|
```
|
|
147
143
|
|
|
144
|
+
`setDate` resolves when a frame shows the bodies at the new date. The data for
|
|
145
|
+
a date can take time to load, and until then the map shows the date before.
|
|
146
|
+
|
|
148
147
|
### Measuring
|
|
149
148
|
|
|
150
149
|
Some things can be read off the scene instead of drawn on it. All take the
|
|
151
|
-
bodies where the last frame put them, so after `setDate` wait for
|
|
152
|
-
before asking.
|
|
150
|
+
bodies where the last frame put them, so after `setDate` wait for the promise
|
|
151
|
+
it returns before asking.
|
|
153
152
|
|
|
154
153
|
```js
|
|
155
154
|
// Kilometres between two anchors: centres, places on a surface, or one of each.
|