Skip to content

Documentation / @interstellar-tools/tracking / globeView

Function: globeView() ​

ts
function globeView(
  points: readonly Pick<GeodeticCoordinatesInterface, 'phi' | 'lambda'>[],
  R?: number,
  options?: GlobeViewOptionsInterface
): GlobePointInterface[];

Defined in: satellites/globe.ts:191

Points on a globe view: the orthographic projection, a globe seen from far away, with the points on the far side marked hidden. It draws ground tracks and footprints on a 2D globe, without WebGL.

x=Rcos⁡φsin⁡(λ−λ0)y=R(cos⁡φ0sin⁡φ−sin⁡φ0cos⁡φcos⁡(λ−λ0))cos⁡c=sin⁡φ0sin⁡φ+cos⁡φ0cos⁡φcos⁡(λ−λ0)

A point is visible when cos⁡c≥0: within 90° of the centre of the view.

Where:

  • φ, λ are the point's latitude and longitude (rad)
  • φ0, λ0 are those of the centre of the view (rad)
  • R is the globe's radius on the screen, in any unit

Units

  • Inputs: latitudes and longitudes in radians; R in the unit of the drawing.
  • Output: x and y in the unit of R, from the centre of the disc, with visible.

Notes

  • Every point gets x and y, the far side's mirrored onto the disc, so a renderer can fade them or break a line where it goes behind. orthographic in @interstellar-tools/maps throws for them instead.
  • For points on the ground: a satellite above the far side can still show past the edge of the disc. Project its 3D position from orbitPath3D for that.
  • Any h on the points is ignored.

Parameters ​

ParameterTypeDefault valueDescription
pointsreadonly Pick<GeodeticCoordinatesInterface, "phi""lambda">[]undefined
R?number1The globe's radius, in the unit of the drawing (finite, > 0): 1 by default.
options?GlobeViewOptionsInterface{}The centre of the view, phi0 and lambda0 in radians: 0 and 0 by default.

Returns ​

GlobePointInterface[]

The points on the disc, in order: see GlobePointInterface.

Throws ​

  • If a latitude, longitude, R, phi0 or lambda0 is not a finite number.
  • If a latitude or phi0 is outside [-π/2, π/2], or R <= 0.

Example ​

ts
// The ISS's next orbit, on a globe of radius 200 px centred on Oslo
const track = groundTrack(iss, now, later).flat();
const view = globeView(track, 200, {
  phi0: toRad(59.91),
  lambda0: toRad(10.75)
});

view.filter(({ visible }) => visible); // the part of the track on the near side

See ​