elementsFromfunction
A source of element sets read from an address of your choosing, with whose data it is. The address is read through fetchElements, so its politeness rules apply (one request in two hours, a refusal is left alone for an hour,
nothing at rest); the sets are read once, when the source is added. The package has no address of its own and never asks one by itself.
Import it
import { elementsFrom } from "@johnmorrisdotca/chikyu-earth/door";
Definition
function elementsFrom(url: string, info: SourceInfo, options?: FetchElementsOptions): ElementRecordSource
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The address of OMM JSON, OMM CSV or TLE text. |
info | SourceInfo | Who the data is: its id, credit, licence and page. |
options (optional) | FetchElementsOptions | What |
Returns
ElementRecordSource
The source, for addSource or sources.
Examples
import { elementsFrom } from "@johnmorrisdotca/chikyu-earth/door";
const mine = elementsFrom("https://example.org/elements/bright.json", {
id: "my-elements",
name: { en: "My elements", ja: "私の軌道要素" },
credit: { en: "Orbit data: my own mirror", ja: "軌道データ:私のミラー" },
licence: { name: "CC BY 4.0", url: "https://creativecommons.org/licenses/by/4.0/" },
url: "https://example.org/elements/",
retrieved: "2026-11-11",
});
console.log(mine.info.id);