spacemap 0.1.16 → 0.1.18
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 +20 -20
- package/dist/spacemap.iife.js +110 -110
- package/dist/spacemap.js +110 -110
- package/index.d.ts +29 -9
- package/index.js +169 -28
- 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.18/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:
|
|
@@ -123,6 +119,7 @@ hold.release();
|
|
|
123
119
|
| `featureselect` | a nomenclature label was clicked |
|
|
124
120
|
| `clock` | the date, play state, rate or direction changed |
|
|
125
121
|
| `loading` / `progress` | data is coming in |
|
|
122
|
+
| `idle` | the camera is at rest and the view is fully loaded |
|
|
126
123
|
| `error` | the data could not be loaded |
|
|
127
124
|
| `notice` / `noticedismiss` | a condition worth telling the reader about |
|
|
128
125
|
| `layerschange` | a layer was switched |
|
|
@@ -140,15 +137,18 @@ map was opened on a date.
|
|
|
140
137
|
map.clock.pause();
|
|
141
138
|
map.clock.setTimeScale(86400); // a day a second
|
|
142
139
|
map.clock.toggleDirection();
|
|
143
|
-
map.clock.setDate(new Date('2035-06-01'));
|
|
140
|
+
await map.clock.setDate(new Date('2035-06-01'));
|
|
144
141
|
map.clock.now();
|
|
145
142
|
```
|
|
146
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
|
+
|
|
147
147
|
### Measuring
|
|
148
148
|
|
|
149
149
|
Some things can be read off the scene instead of drawn on it. All take the
|
|
150
|
-
bodies where the last frame put them, so after `setDate` wait for
|
|
151
|
-
before asking.
|
|
150
|
+
bodies where the last frame put them, so after `setDate` wait for the promise
|
|
151
|
+
it returns before asking.
|
|
152
152
|
|
|
153
153
|
```js
|
|
154
154
|
// Kilometres between two anchors: centres, places on a surface, or one of each.
|