Skip to content

astro.Function.nearestNebulae

github-actions[bot] edited this page Aug 26, 2026 · 73 revisions

@elite-dangerous-almanac/core / astro / nearestNebulae

Function: nearestNebulae()

nearestNebulae(coords, nebulae, count?): NebulaWithDistance[]

Defined in: src/astro/nebulae.ts:174

The nebulae closest to a point, nearest first.

Parameters

coords

GalacticPosition

The point to measure from, in light-years (Sol at origin). A ProceduralSystem.position value fits once you have narrowed it — it is GalacticPosition | null, and is null unless that system was built from an address and you supplied its coordinates, so null-check it first.

nebulae

readonly Nebula[]

The catalogue to search — REAL_NEBULAE, PLANETARY_NEBULAE, PROCGEN_NEBULAE, ALL_NEBULAE, or any subset you have filtered yourself.

count?

number = 3

How many to return. Defaults to 3. Fractional values are truncated towards zero, values <= 0 and NaN yield an empty array, and a count larger than the catalogue returns the whole catalogue.

Returns

NebulaWithDistance[]

Up to count nebulae sorted by ascending NebulaWithDistance.distanceLy. Ties keep catalogue order. The input array is not modified.

Example

import { nearestNebulae } from '@elite-dangerous-almanac/core/astro/nebulae';
import { REAL_NEBULAE } from '@elite-dangerous-almanac/core/astro/nebulae-real';

// The three real nebulae nearest Sol
nearestNebulae({ x: 0, y: 0, z: 0 }, REAL_NEBULAE).map((n) => n.name);
// -> [ 'Pleiades', 'R Cra', 'Lupus Dark Region B' ]  (nearest first)

nearestNebulae({ x: 0, y: 0, z: 0 }, REAL_NEBULAE, 1)[0]?.distanceLy; // -> ≈383.31

API

Guides
astro
Classes (1)
ProceduralSystem

Properties

Accessors

Methods

Interfaces (16)
Type Aliases (3)
Variables (11)
Functions (37)
Subpath modules (3)
commodities
Interfaces (1)
Type Aliases (1)
Variables (3)
Functions (3)
equipment
Interfaces (6)
Type Aliases (8)
Variables (3)
Functions (10)
Subpath modules (2)
i18n
Interfaces (1)
Type Aliases (1)
Functions (17)
materials
Enumerations (2)
Interfaces (2)
Type Aliases (2)
Variables (9)
Functions (9)
ships
Classes (3)
BuildMetrics

Methods

LoadoutEditError

Constructors

Properties

Methods

ShipLoadout

Accessors

Methods

Interfaces (125)
Type Aliases (44)
Variables (10)
Functions (85)
Subpath modules (8)

Clone this wiki locally