Skip to the content

Chikyu Earth documentation

Chikyu Earth API: every export

Every export of every entry point, each with its own page. This page keeps the addresses the old one-page reference had.

@johnmorrisdotca/chikyu-earth/element

ChikyuEarthclass

The <chikyu-earth> custom element: the line globe, drawn as SVG in its shadow root.

@johnmorrisdotca/chikyu-earth/realistic

ATMOSPHERE_OUTERconstant

The glow reaches this many radii from the centre; the globe at 1x is drawn to fit inside it.

chooseTierfunction

The width to hold for a layer when the globe's disc has radius radiusPx device pixels: the smallest shipped width that gives TEXELS_PER_RADIUS_PIXEL texels per pixel, else the largest, never more than cap, never less than the smallest.

createGatefunction

A rate gate for the draw: asks that come faster than minMs apart become one, and the last ask is never lost, so a burst of changes costs one draw.

discRadiusfunction

The disc's radius in CSS pixels in a box of width x height at zoom: it fits the glow in the box at 1x.

frameCapfunction

The frame rate cap for this device: maxFps (30 by default), lower on a small device.

Gatetype

A rate gate for the draw: what createGate returns.

julianDayfunction

Julian day number of a moment in milliseconds since the Unix epoch.

Layertype

One of the pictures the realistic Earth and the space view draw with: day, night, clouds, water and moon.

LightModetype

How the Earth is lit: sun (the true light, with the night side dark and the city lights on it), lit (always lit, as if by daylight from the camera's side, the day picture and no city lights: the night side is never a black frame) or boost (the true terminator, with the night side raised so the land and coasts read).

lookAtfunction

Where the view is centred on the globe: the home centre, turned by yaw (west) and tipped by tilt (south), held to the poles; a drag right is yaw and a drag up is tilt, and the ground follows the pointer.

MAX_TEXTUREconstant

The most pixels across a texture the package ever asks the GPU for.

subsolarPointfunction

The point where the Sun is at the zenith at ms: latitude is the Sun's declination, longitude runs west at 15 degrees an hour.

TEXELS_PER_RADIUS_PIXELconstant

Texels across the whole circumference wanted per device pixel of the globe's radius: 3 is a little under 2 pi, so a texel is a little larger than a pixel.

textureBytesfunction

Bytes of GPU memory a texture of this width costs, with its mipmaps, at 4 bytes a pixel (the most it can be).

textureCapfunction

The cap for this device: low-memory phones stop at 2048, and the GPU's own limit and the option are never passed.

ThreePartstype

The parts of three.js the Earth and the space view use.

TIERSconstant

The widths each layer is shipped in (every picture is 2:1, so the height is half).

unitVectorfunction

A point on the globe as a unit vector: +z is longitude 0 on the equator, +x east, +y north.

@johnmorrisdotca/chikyu-earth/realistic/element

ChikyuEarthRealisticclass

The <chikyu-earth-realistic> custom element: the Earth from space, drawn with three.js through kazoku-ui's shared renderer (one WebGL context for the page).

EarthStatetype

What the realistic Earth is doing: loading its pictures, live and drawing, unavailable (no WebGL), lost (the GPU took the context; it comes back by itself) or idle (another view has the page's one WebGL context; press or focus it to take it).

readTimefunction

A time attribute: "now" (or none) follows the clock, else an ISO date such as 2026-06-21T12:00:00Z.

setSharedRendererfunction

Hands the elements a renderer the page made, so a page that draws other things with kazoku-ui's shared renderer keeps one WebGL context for all of them.

setThreeLoaderfunction

Where three.js comes from, if a page wants to hand it over itself (before the first element connects).

@johnmorrisdotca/chikyu-earth/markers

attachMarkersfunction

Put markers on a globe, for either look: dots drawn in one pass on a canvas, a few labels as real buttons, crowded places gathered into clusters.

canvasRatiofunction

The pixel ratio for an overlay canvas: the device's, to 2, held to 4096 a side and 6 million pixels (the same budget as the 3D canvas).

Clustertype

Several points gathered into one on the screen: where it is drawn and which points are in it.

clusterPointsfunction

Group the points indices (into xs and ys) by the grid cell they fall in.

GroupInfotype

One group of markers: its name, how many it holds and whether it is shown.

LabelItemtype

One label to place: its dot's centre and radius, its box's size and its priority.

MarkerEventDetailtype

What the chikyu-marker-hover, chikyu-marker-click and chikyu-marker-focus events carry in event.detail.

MarkerIcontype

The shapes a marker can be drawn as: dot, ring, square or diamond.

MarkerOptionstype

What attachMarkers may be asked: the most labels, how close markers gather, and the default colour.

Markerstype

The markers on one globe: add, update, remove and find them, show or hide groups, and detach.

OverlayElementtype

An element markers can be put on: any HTML element with an overlay (both <chikyu-earth> and <chikyu-earth-realistic> have one).

OverlayHosttype

What an element gives the markers (element.overlay): a box laid over its view, the pose of its last draw, and a way to hear the next ones.

OverlayPosetype

The pose of an element's last drawing, with the size of its box and the CSS transform its picture carries between redraws.

placeLabelsfunction

Place up to max labels inside width x height.

Placementtype

Where one label goes: which item it is and its box's top-left corner.

Posetype

The view: the point of the Earth at the middle of the disc, the disc's radius and its centre, in CSS pixels.

projectfunction

Project a longitude and latitude (degrees) to the screen.

projectAllfunction

Project many points into flat arrays (reused between calls); z is the cosine used for a point's facing test.

@johnmorrisdotca/chikyu-earth/space

blendfunction

A frame between two others, t from 0 to 1.

BodyDrawingtype

One body as drawn by a painter: an object of radius 1 at the origin, which the scene places, scales and (for the Sun) turns to face the camera.

BodyMoontype

One moon of a planet at a moment: its name, where it is from the planet's centre and how big it is, both in radii of the planet, in scene axes.

BodyPaintertype

The seam for drawing the Sun, the planets and their moons.

compressfunction

The same direction at a compressed distance from the Earth: the Moon is 10 Earth radii away, and a body k times further than the Moon is k^0.25 times as far here.

createTrackfunction

Answers for any moment from two real ones: at(ms) asks astronomy-engine only when ms leaves the span the last two answers cover, and then looks stepMs ahead, so playing time at a steady rate costs one pair of lookups every stepMs and every draw in between is arithmetic.

EARTH_RADIUS_KMconstant

The Earth's radius in kilometres, the unit of the scene's distances.

Frametype

Where everything is at one moment: positions in astronomical units from the Earth's centre, in scene axes (x to the vernal equinox, y north, z toward -y of the equator).

frameAtfunction

The state of the sky at ms: nine vectors and an angle, in a few tenths of a millisecond.

MOON_COMPRESSEDconstant

The Moon's distance in a compressed view, in Earth radii (the true one is about 60).

orbitPathfunction

The path a planet takes round the Sun, as count points around the orbit that starts where the planet is at ms, relative to the Sun (scene axes, AU).

PaintContexttype

What the scene tells a painter when it makes a body.

placeAroundfunction

A place helio astronomical units from the Sun (a planet, or a point on its orbit), round the Sun at sun.

placeMoonfunction

The Moon, from the Earth's centre.

placeSunfunction

The Sun, from the Earth's centre: in a compressed view always 44 Earth radii away, in its real direction.

plainPainterconstant

The default look: a sphere in the planet's colour, lit by the Sun, and for the Sun a glowing disc.

PlanetNametype

One of the planets drawn (Pluto too), by name.

PLANETSconstant

The planets drawn, nearest the Sun first.

RADIUSconstant

Radii in Earth radii: the real ones, and ones large enough to see in a compressed view.

RIDE_FOVconstant

The field of view, in degrees, of a camera riding along at zoom 1 (the Earth's view from outside is 35).

RideInputtype

What ridePose is asked: the camera's place and its way of travel (any length), where it looks, and the shared controls' yaw, tilt and zoom.

RideLooktype

Where a riding camera looks: down straight at the Earth's centre (the ground goes by under the camera), or horizon tipped forward along the way it is going until the horizon is a little above the middle of the view.

ridePosefunction

The camera of a body-borne view: at position, looking at the Earth, with the way the body is going at the top of the picture.

RidePosetype

The camera ridePose works out: where it is, which way it looks, which way is up in the picture, its field of view in degrees, and how big the Earth looks from there (its angular radius in degrees).

ScaleModetype

The scale the space view is drawn in: compressed squeezes the distances so the Moon, the Sun and Neptune fit one view, and true keeps the real ones.

SUN_COMPRESSEDconstant

The Sun's distance from the Earth in a compressed view, in Earth radii (the true one is about 23,500).

truePositionfunction

A place in astronomical units from the Earth's centre, at true distance, in Earth radii.

Vec3type

A position or direction as [x, y, z], in the scene's axes (x toward the vernal equinox, y north).

@johnmorrisdotca/chikyu-earth/space/element

BODY_NAMESconstant

The eleven bodies the space view places, names and lets a reader choose: the Earth, the Sun, the Moon, the seven other planets and Pluto.

BodyInfotype

What a page can tell a reader about a body now.

BodyNametype

The name of one of the bodies in BODY_NAMES.

ChikyuSpaceclass

The <chikyu-space> custom element: the Earth, the Moon, the Sun and the planets where they are at a date and time, drawn with three.js through the shared renderer.

RideOptionstype

How a ride along is done: view from (the default) puts the camera at the body looking at the Earth, follow keeps it a fixed distance from the body looking at it (distanceKm, 3000 by default, for a satellite; a planet or the Moon is kept at the distance the zoom says); look down (the default) or horizon is where a camera at the body points; smooth (the default) glides from the old camera to the new one in about a second and a bit, and jumps instead for a reader who asked for reduced motion.

RideTargettype

What a camera can ride along with: the name of one of the bodies, or a satellite of a group ({ group, index }).

Ridingtype

What the camera is riding along with now: the body or satellite, how (from or follow), where it looks, and the distance kept for a satellite.

setBodyPainterfunction

Change how the Sun and the planets are drawn (before the first element connects): the space view keeps their places, sizes, light, names and orbits and asks the painter only for what to draw at each place (see BodyPainter).

setThreeLoaderfunction

Where three.js comes from, if a page wants to hand it over itself (before the first element connects).

SpacePresettype

A named distance for zoomFor: the Earth, the Moon, the Sun, the inner planets, the whole solar system, or a planet with its nearer moons (Jupiter-moons: the zoom that shows them, when a body painter that draws moons is set).

SpaceStatetype

What the space view is doing: loading, live, unavailable (no WebGL), lost (the GPU took the context; it comes back by itself) or idle (another view has the page's one context).

@johnmorrisdotca/chikyu-earth/satellites

DEFAULT_MAX_AGE_DAYSconstant

How old, in days, an element set may be at the moment shown before the satellite is left out: SGP4's error grows by a few kilometres a day, so a fortnight is as far as a picture should trust.

ElementSettype

One satellite's orbital elements in the "GP" format that CelesTrak and Space-Track both serve as JSON (CCSDS OMM, one object per satellite).

MAX_SATELLITE_SPEEDconstant

The fastest clock, in game seconds a second, at which the space view still places a group of satellites: above it the two moments SGP4 is run at would be too far apart to interpolate, so the group is hidden rather than drawn wrongly.

RefusedElementSettype

A satellite the group could not use, and why: its elements did not start SGP4 (bad numbers), or it had decayed at its own epoch.

SatelliteInfotype

What a page can tell a reader about one satellite at a moment: its name, its number, how old its elements are, how high and how fast it is.

SatelliteReftype

A satellite chosen from a group: which group and which place in it.

Satellitestype

A group of satellites, ready to give positions for any moment: what createSatellites returns, and what <chikyu-space> takes in setSatellites.

@johnmorrisdotca/chikyu-earth

centreRotationfunction

The rotation that puts centre in the middle of the disc: d3-geo's rotate is the negative of the point.

cleanStylefunction

A value from outside (an attribute, a query parameter) as a style's name: the default for anything else.

COUNTRIESconstant

Every country the globe draws, as GeoJSON in longitude and latitude (177 features, Antarctica included), each with its English name, its Japanese name and its two-letter code.

countryListfunction

Every country the globe draws, with its kuni name and code.

CountryPropstype

What one country's outline carries: its English and Japanese name and its ISO alpha-2 code, all from kuni.

DEFAULT_STYLEconstant

The style a drawing is in when none is named.

DEGREES_PER_MSconstant

How far the Earth turns in one millisecond, in degrees.

GeoPointtype

A point on the globe, in degrees: lon from -180 to 180 (east is positive), lat from -90 to 90 (north is positive).

globefunction

The globe as an SVG string, turned to rotation and drawn in style, size pixels square.

globeBaseScalefunction

The radius of an unzoomed globe in a square of size pixels.

GlobeViewtype

What a shared view controller tells the globe: its turn (yaw, degrees), tip (tilt, degrees), zoom (1 is Fit) and pan (panX and panY, CSS pixels).

HOME_VIEWconstant

The view when it opens: the home centre, upright, at 1x with no pan.

projectionViewfunction

What the projection is given for a view: yaw turns longitude, tilt tips latitude, zoom scales and pan moves the disc in CSS pixels.

ProjectionViewtype

What d3-geo's orthographic projection is given for a view: its rotation, scale and translation.

Rotationtype

How the globe is turned: [lambda, phi] in degrees, the pair d3-geo's rotate takes.

rotationAtfunction

The rotation at now for a globe that was centred on centre at start.

SIDEREAL_DAY_MSconstant

One sidereal day — the Earth's turn against the stars, 23 h 56 min 4.0905 s — in milliseconds.

spinAtfunction

How far the Earth has turned after ms milliseconds, in degrees.

Styletype

The lines and fills of one look: colours and widths only, never the geometry.

STYLE_NAMESconstant

Every style's name, in the order they are listed.

StyleNametype

The name of a look: "line" or "thick".

STYLESconstant

The looks the globe is drawn in, by name: line (thin outlines) and thick.