Skip to the content

Chikyu Earth地球

A line-drawn globe of the world's countries that turns at the Earth's own rate, with an optional realistic Earth from space and markers for any place.

Chikyu is the Japanese word 地球 for the Earth. About the name

Contents

Reference · Satellites: orbital elements in, positions out

fetchElementsfunction

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 it

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

Definition

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

Parameters

NameTypeDescription
urlstring

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

options (optional)FetchElementsOptions

See FetchElementsOptions.

Returns

Promise<ElementSource>

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

Examples

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);

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chikyu-earth 0.51.1.