本文へ移動

Chikyu Earth地球

世界の国の輪郭を線で描いた地球儀です。地球と同じ速さで回ります。宇宙から見たような地球と、好きな場所の目印も使えます。

「地球」(ちきゅう) は、私たちが住む星の名前です。 名前について(英語)

目次

リファレンス · 人工衛星: 軌道要素から位置を計算

fetchElements関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

Ask a source of your own choosing for element sets, in the visitor's browser, and read them. The package has no address of its own: you pass one, and you are the one to read that source's terms (docs/satellite-sources.md has what CelesTrak, Space-Track and others say). It is polite by design:

  • only https (or http on localhost), with no cookies and no referrer sent;
  • the same address is not asked again within minIntervalMs (2 hours): the answer already read is returned, from this page or from localStorage;
  • any answer that is not 200, or no answer, stops the asking: the address is left alone for blockedMs (1 hour) and a ElementSourceError with the status says so (the answer already read, if there is one, is returned instead);
  • an answer over maxBytes or maxSets is refused. The source must send the headers a browser needs to let a page read it (CORS); one that does not cannot be read from a page, and no workaround is made here.

インポート

import { fetchElements } from "@johnmorrisdotca/chikyu-earth/satellites";

定義

function fetchElements(url: string, options?: FetchElementsOptions): Promise<ElementSource>

引数

名前型説明
urlstring

The address of OMM JSON, OMM CSV or TLE text.

options (省略可)FetchElementsOptions

See FetchElementsOptions.

戻り値

Promise<ElementSource>

The element sets, ready for createSatellites, with where and when they came from.

例

import { createSatellites, fetchElements } from "@johnmorrisdotca/chikyu-earth/satellites";

// An address you chose, whose terms you have read. This one answers made-up elements.
const source = await fetchElements("https://example.org/my-elements.json");
const group = createSatellites(source.sets);
console.log(group.count, source.skipped.length, source.fromCache);

ソースを見るGitHub で編集@johnmorrisdotca/chikyu-earth 0.51.1 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。