aviation-math
Version:
Different methods to calculate distances, bearing and projections for aviation related software
96 lines (95 loc) • 3.2 kB
TypeScript
import { NauticalMiles } from "./common";
/**
* This class is a container for a position based on geo coordinates.
*/
export declare class Position {
private _lat;
private _lon;
/**
* The constructor offers the possibility of instatiating the class with
* parameters lat and lon, or by just using the first parameter lat with
* a formatted position given.
*
* @example
* const pos1 = new Position(35.161372664038055, 33.267828863069205);
* const pos2 = new Position("35.161372664038055 N 33.267828863069205 E");
* const pos3 = new Position("40° 7.38' 74° 7.38'");
*
* @param lat The latitude part of the position as a number or a formatted position string
* @param lon The optional longitude
*/
constructor(lat: number | string, lon?: number);
get lat(): number;
get lon(): number;
get latDegrees(): number;
get lonDegrees(): number;
get latDegreesAbs(): number;
get lonDegreesAbs(): number;
get latMinutes(): number;
get lonMinutes(): number;
get latMinutesAbs(): number;
get lonMinutesAbs(): number;
get latSeconds(): number;
get lonSeconds(): number;
get latSecondsAbs(): number;
get lonSecondsAbs(): number;
get latHemisphere(): string;
get lonHemisphere(): string;
get isNorthernHemisphere(): boolean;
get isSouthernHemisphere(): boolean;
get isEasternHemisphere(): boolean;
get isWesternHemisphere(): boolean;
get declination(): number;
/**
* This is a helper function to calculate the distance to a given position
*
* @param position The reference position
* @returns The distance in nautical miles
*/
getDistanceTo(position: Position): NauticalMiles;
/**
* This function formats the current position in the DMS format.
*
* @example
* const pos = new Position(50.02756868784301, 8.534261553454376);
* const formatted = pos.toDMS();
* // formatted = "50° 01′ 39.25″ N 008° 32′ 03.34″ E"
*
* @returns The formatted coordinates
*/
toDMS(): string;
/**
* This function formats the current position in the DMS format but concatenated
* which is useful mostly for fmc or software input.
*
* @example
* const pos = new Position(50.02756868784301, 8.534261553454376);
* const formatted = pos.toDMSCode();
* // formatted = "500139N0083203E"
*
* @returns The formatted coordinates
*/
toDMSCode(): string;
/**
* This function formats the current position in the DMM format.
*
* @example
* const pos = new Position(50.02756868784301, 8.534261553454376);
* const formatted = pos.toDMM();
* // formatted = "50° 1.654′ N 008° 32.056′ E"
*
* @returns The formatted coordinates
*/
toDMM(): string;
/**
* This function formats the current position in the DDD format.
*
* @example
* const pos = new Position(50.02756868784301, 8.534261553454376);
* const formatted = pos.toDMM();
* // formatted = "50.0276° N 008.5343° E"
*
* @returns The formatted coordinates
*/
toDDD(): string;
}