UNPKG

haversine-position

Version:

Convert GPS coordinates into local coordinate system relative to the origin with output of [x, y] in meter, bearing(degree) and distance(m)

46 lines (45 loc) 1.65 kB
import { GpsPoint } from './gpsPoint'; export declare class Haversine { private origin; private R; constructor(origin: GpsPoint); /** * Get the distance of the next point relative to the origin * @param origin the origin gps coordinate * @param next next gps coordinate * @returns distance in meter (m) */ static getDistance(origin: GpsPoint, next: GpsPoint): number; /** * Get the bearing of the next point relative to the origin * @param origin the origin gps coordinate * @param next next gps coordinate * @returns bearing in degree (deg) */ static getBearing(origin: GpsPoint, next: GpsPoint): number; /** * Get the next gps coordinate position relative to the origin * @param origin the origin gps coordinate * @param next the next gps coordinate * @returns [x, y] in meter (m) relative to the origin */ static getPosition(origin: GpsPoint, next: GpsPoint): number; /** * Get the next gps coordinate position relative to the origin * @param next the next gps coordinate * @returns [x, y] in meter (m) relative to the origin */ getPosition(next: GpsPoint): any; /** * Get the distance of the next point relative to the origin * @param next next gps coordinate * @returns distance in meter (m) */ getDistance(next: GpsPoint): number; /** * Get the bearing of the next point relative to the origin * @param next next gps coordinate * @returns bearing in degree (deg) */ getBearing(next: GpsPoint): number; }