UNPKG

s2-tools

Version:

A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.

53 lines 1.69 kB
import type { VectorPoint } from '../geometry'; /** * # Orthodrome * * ## Description * Represents an orthodrome, which is the shortest path between two points on a sphere. * [Learn more here](http://www.movable-type.co.uk/scripts/latlong.html) * * ## Usage * ```ts * import { Orthodrome } from 's2-tools' * * // starting at lon-lat (-60, -40) and ending at (20, 10) * const orthodrome = new Orthodrome(-60, -40, 20, 10); * // { x: -39.13793657428956, y: -33.72852197561652 } * const intermediatePoint = orthodrome.intermediatePoint(0.2); * // Distance in KM: 1.5514126949321814 * const distance = orthodrome.distanceTo(); */ export declare class Orthodrome { /** start longitude */ readonly lon1: number; /** start latitude */ readonly lat1: number; /** end longitude */ readonly lon2: number; /** end latitude */ readonly lat2: number; /** distance property */ readonly a: number; /** distance property */ readonly dist: number; /** * @param startLon - start longitude * @param startLat - start latitude * @param endLon - end longitude * @param endLat - end latitude */ constructor(startLon: number, startLat: number, endLon: number, endLat: number); /** * input t 0->1. Find a point along the orthodrome. * @param t - distance along the orthodrome to find * @returns [lon, lat] */ intermediatePoint(t: number): VectorPoint; /** * Finds the distance between the two points in kilometers * projected normalized (0->1) * @returns - total distance between the two points */ distanceTo(): number; } //# sourceMappingURL=orthodrome.d.ts.map