UNPKG

3.4 kBTypeScriptView Raw
1import L from "leaflet";
2export interface GeodesicOptions extends L.PolylineOptions {
3 wrap?: boolean;
4 steps?: number;
5 radius?: number;
6}
7export interface WGS84Vector extends L.LatLngLiteral {
8 bearing: number;
9}
10export interface GeoDistance {
11 distance: number;
12 initialBearing: number;
13 finalBearing: number;
14}
15export declare class GeodesicCore {
16 readonly options: GeodesicOptions;
17 readonly ellipsoid: {
18 a: number;
19 b: number;
20 f: number;
21 };
22 constructor(options?: GeodesicOptions);
23 toRadians(degree: number): number;
24 toDegrees(radians: number): number;
25 /**
26 * implements scientific modulus
27 * source: http://www.codeavenger.com/2017/05/19/JavaScript-Modulo-operation-and-the-Caesar-Cipher.html
28 * @param n
29 * @param p
30 * @return
31 */
32 mod(n: number, p: number): number;
33 /**
34 * source: https://github.com/chrisveness/geodesy/blob/master/dms.js
35 * @param degrees arbitrary value
36 * @return degrees between 0..360
37 */
38 wrap360(degrees: number): number;
39 /**
40 * general wrap function with arbitrary max value
41 * @param degrees arbitrary value
42 * @param max
43 * @return degrees between `-max`..`+max`
44 */
45 wrap(degrees: number, max?: number): number;
46 /**
47 * Vincenty direct calculation.
48 * based on the work of Chris Veness (https://github.com/chrisveness/geodesy)
49 * source: https://github.com/chrisveness/geodesy/blob/master/latlon-ellipsoidal-vincenty.js
50 *
51 * @param start starting point
52 * @param bearing initial bearing (in degrees)
53 * @param distance distance from starting point to calculate along given bearing in meters.
54 * @param maxInterations How many iterations can be made to reach the allowed deviation (`ε`), before an error will be thrown.
55 * @return Final point (destination point) and bearing (in degrees)
56 */
57 direct(start: L.LatLng, bearing: number, distance: number, maxInterations?: number): WGS84Vector;
58 /**
59 * Vincenty inverse calculation.
60 * based on the work of Chris Veness (https://github.com/chrisveness/geodesy)
61 * source: https://github.com/chrisveness/geodesy/blob/master/latlon-ellipsoidal-vincenty.js
62 *
63 * @param start Latitude/longitude of starting point.
64 * @param dest Latitude/longitude of destination point.
65 * @return Object including distance, initialBearing, finalBearing.
66 */
67 inverse(start: L.LatLng, dest: L.LatLng, maxInterations?: number, mitigateConvergenceError?: boolean): GeoDistance;
68 /**
69 * Returns the point of intersection of two paths defined by position and bearing.
70 * This calculation uses a spherical model of the earth. This will lead to small errors compared to an ellipsiod model.
71 * based on the work of Chris Veness (https://github.com/chrisveness/geodesy)
72 * source: https://github.com/chrisveness/geodesy/blob/master/latlon-spherical.js
73 *
74 * @param firstPos 1st path: position and bearing
75 * @param firstBearing
76 * @param secondPos 2nd path: position and bearing
77 * @param secondBearing
78 */
79 intersection(firstPos: L.LatLng, firstBearing: number, secondPos: L.LatLng, secondBearing: number): L.LatLng | null;
80 midpoint(start: L.LatLng, dest: L.LatLng): L.LatLng;
81}
82
\No newline at end of file