mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 17:20:09 +00:00
added type definitions for geodesy v2 (#40551)
This commit is contained in:
committed by
Sheetal Nandi
parent
f9c2fefc56
commit
a66bf707ff
25
types/geodesy/dms.d.ts
vendored
Normal file
25
types/geodesy/dms.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import { Format, Dp } from '.';
|
||||
|
||||
type Precision = 1 | 2 | 3;
|
||||
|
||||
// tslint:disable-next-line no-unnecessary-class
|
||||
declare class Dms {
|
||||
static get separator(): string;
|
||||
static set separator(char: string);
|
||||
static parse(dms: string | number): number;
|
||||
static toDms(deg: number, format?: Format, dp?: Dp): string;
|
||||
static toLat(deg: number, format?: Format, dp?: Dp): string;
|
||||
static toLon(deg: number, format?: Format, dp?: Dp): string;
|
||||
static toBrng(deg: number, format?: Format, dp?: Dp): string;
|
||||
static fromLocale(str: string): string;
|
||||
static toLocale(str: string): string;
|
||||
static compassPoint(bearing: number, precision?: Precision): string;
|
||||
static wrap360(degrees: number): string;
|
||||
static wrap90(degrees: number): string;
|
||||
}
|
||||
|
||||
export default Dms;
|
||||
@@ -1,12 +1,14 @@
|
||||
import {
|
||||
Mgrs,
|
||||
Utm,
|
||||
Dms,
|
||||
Vector3d,
|
||||
OsGridRef,
|
||||
LatLonEllipsoidal as LatLon, LatLonSpherical,
|
||||
LatLonVectors
|
||||
} from 'geodesy';
|
||||
/*
|
||||
* @format
|
||||
*/
|
||||
import Mgrs, { LatLon as Latlon_Utm_Mgrs } from 'geodesy/mgrs';
|
||||
import Utm from 'geodesy/utm';
|
||||
import Dms from 'geodesy/dms';
|
||||
import Vector3d from 'geodesy/vector3d';
|
||||
import OsGridRef, { LatLon as LatLon_OsGridRef } from 'geodesy/osgridref';
|
||||
import LatLonEllipsoidalDatum from 'geodesy/latlon-ellipsoidal-datum';
|
||||
import LatLonSpherical from 'geodesy/latlon-spherical';
|
||||
import LatLonNvectorSpherical from 'geodesy/latlon-nvector-spherical';
|
||||
|
||||
/**
|
||||
* Mgrs
|
||||
@@ -15,11 +17,8 @@ const mgrs = new Mgrs(31, 'U', 'D', 'Q', 48251, 11932);
|
||||
const bandMgrs = mgrs.band;
|
||||
const datumMgrs = mgrs.datum;
|
||||
const e100kMgrs = mgrs.e100k;
|
||||
const e100kLettersMgrs = mgrs.e100kLetters;
|
||||
const eastingMgrs = mgrs.easting;
|
||||
const latBandsMgrs = mgrs.latBands;
|
||||
const n100kMgrs = mgrs.n100k;
|
||||
const n100kLettersMgrs = mgrs.n100kLetters;
|
||||
const northingMgrs = mgrs.northing;
|
||||
const zoneMgrs = mgrs.zone;
|
||||
mgrs.toString();
|
||||
@@ -38,8 +37,7 @@ const eastingUtm = utm.easting;
|
||||
const hemisphereUtm = utm.hemisphere;
|
||||
const northingUtm = utm.northing;
|
||||
const scaleUtm = utm.scale;
|
||||
utm.toLatLonE();
|
||||
utm.toMgrs();
|
||||
utm.toLatLon();
|
||||
utm.toString();
|
||||
|
||||
// Static Functions
|
||||
@@ -52,12 +50,12 @@ Utm.parse('31 N 448251 5411932');
|
||||
Dms.separator = '\u202f';
|
||||
|
||||
// Static Functions
|
||||
Dms.parseDMS('51° 28′ 40.12″ N');
|
||||
Dms.parse('51° 28′ 40.12″ N');
|
||||
|
||||
Dms.toDMS(45);
|
||||
Dms.toDMS(45, 'dm');
|
||||
Dms.toDMS(45, 'd', 2);
|
||||
Dms.toDMS(45, 'dms', 4);
|
||||
Dms.toDms(45);
|
||||
Dms.toDms(45, 'dm');
|
||||
Dms.toDms(45, 'd', 2);
|
||||
Dms.toDms(45, 'dms', 4);
|
||||
|
||||
Dms.toLat(45);
|
||||
Dms.toLat(45, 'dm');
|
||||
@@ -91,31 +89,31 @@ v1.cross(v2).dot(v3);
|
||||
/**
|
||||
* LatLon
|
||||
*/
|
||||
const latlon = new LatLon(52.65798, 1.71605);
|
||||
const latlonWGS84 = new LatLon(51.4778, -0.0016, LatLon.datum.WGS84);
|
||||
const pWGS84 = new LatLon(51.4778, -0.0016, LatLon.datum.WGS84);
|
||||
const pOSGB = pWGS84.convertDatum(LatLon.datum.OSGB36);
|
||||
const latlon = new LatLonEllipsoidalDatum(52.65798, 1.71605);
|
||||
const latlonWGS84 = new LatLonEllipsoidalDatum(51.4778, -0.0016, 0, LatLonEllipsoidalDatum.datums.WGS84);
|
||||
const pWGS84 = new LatLonEllipsoidalDatum(51.4778, -0.0016, 0, LatLonEllipsoidalDatum.datums.WGS84);
|
||||
const pOSGB = pWGS84.convertDatum(LatLonEllipsoidalDatum.datums.OSGB36);
|
||||
|
||||
latlon.toUtm();
|
||||
latlon.toCartesian();
|
||||
latlon.toString();
|
||||
latlon.toString('dm');
|
||||
latlon.toString('d', 0);
|
||||
|
||||
const mgrsGrid = new LatLon(45.4215296, -75.697193).toUtm().toMgrs();
|
||||
const mgrsGrid = new Latlon_Utm_Mgrs(45.4215296, -75.697193).toUtm().toMgrs();
|
||||
mgrsGrid.toString(6);
|
||||
|
||||
/**
|
||||
* OsGridRef
|
||||
*/
|
||||
const gridref = new OsGridRef(651409, 313177);
|
||||
const osgrid = new OsGridRef(651409.903, 313177.270);
|
||||
const osgrid = new OsGridRef(651409.903, 313177.27);
|
||||
new OsGridRef(651409, 313177).toString();
|
||||
const latlon_osgridref = new LatLon_OsGridRef(52.65798, 1.71605);
|
||||
latlon_osgridref.toOsGrid();
|
||||
osgrid.toLatLon();
|
||||
osgrid.toLatLon(LatLonEllipsoidalDatum.datums.OSGB36);
|
||||
|
||||
// Static Functions
|
||||
OsGridRef.latLonToOsGrid(latlon);
|
||||
OsGridRef.osGridToLatLon(gridref);
|
||||
OsGridRef.osGridToLatLon(gridref, LatLon.datum.OSGB36);
|
||||
OsGridRef.parse('TG 51409 13177');
|
||||
|
||||
/**
|
||||
@@ -126,7 +124,7 @@ const point2 = new LatLonSpherical(48.857, 2.351);
|
||||
|
||||
point1.distanceTo(point2); // 404.3 km
|
||||
point1.distanceTo(point2, 6371e3); // 404.3 km
|
||||
point1.bearingTo(point2); // 156.2°
|
||||
point1.initialBearingTo(point2); // 156.2°
|
||||
point1.finalBearingTo(point2); // 157.9°
|
||||
point1.midpointTo(point2); // 50.5363°N, 001.2746°E
|
||||
point1.intermediatePointTo(point2, 0.25); // 51.3721°N, 000.7073°E
|
||||
@@ -135,9 +133,9 @@ point1.destinationPoint(7794, 300.7, 6371e3); // 51.5135°N, 000.0983°W
|
||||
|
||||
const ctCurrent = new LatLonSpherical(53.2611, -0.7972);
|
||||
const ct1 = new LatLonSpherical(53.3206, -1.7297);
|
||||
const ct2 = new LatLonSpherical(53.1887, 0.1334);
|
||||
ctCurrent.crossTrackDistanceTo(ct1, ct2); // -307.5 m
|
||||
ctCurrent.crossTrackDistanceTo(ct1, ct2, 6371e3); // -307.5 m
|
||||
const ct2 = new LatLonSpherical(53.1887, 0.1334);
|
||||
ctCurrent.crossTrackDistanceTo(ct1, ct2); // -307.5 m
|
||||
ctCurrent.crossTrackDistanceTo(ct1, ct2, 6371e3); // -307.5 m
|
||||
|
||||
point1.maxLatitude(156);
|
||||
|
||||
@@ -160,7 +158,7 @@ eq1.toString('d', 0);
|
||||
|
||||
// Static functions
|
||||
const brng1 = 108.547;
|
||||
const brng2 = 32.435;
|
||||
const brng2 = 32.435;
|
||||
LatLonSpherical.intersection(point1, brng1, point2, brng2); // 50.9078°N, 004.5084°E
|
||||
LatLonSpherical.crossingParallels(point1, point2, 30);
|
||||
|
||||
@@ -169,36 +167,36 @@ LatLonSpherical.areaOf(polygon); // 6.18e9 m²
|
||||
LatLonSpherical.areaOf(polygon, 6371e3); // 6.18e9 m²
|
||||
|
||||
/**
|
||||
* LatLonVectors
|
||||
* LatLonNvectorSpherical
|
||||
*/
|
||||
const point3 = new LatLonVectors(49.78846, -97.44306);
|
||||
const point4 = new LatLonVectors(49.79822, -97.4592);
|
||||
const point5 = new LatLonVectors(49.7981, -97.41371);
|
||||
const point6 = new LatLonVectors(49.76851, -97.41371);
|
||||
const point7 = new LatLonVectors(49.76873, -97.45954);
|
||||
const point8 = new LatLonVectors(49.78846, -97.44306);
|
||||
point3.toVector(); // Vector3d { x: -0.08363305717526297, y: -0.6401716454146233, z: 0.7636660108677438 }
|
||||
const point3 = new LatLonNvectorSpherical(49.78846, -97.44306);
|
||||
const point4 = new LatLonNvectorSpherical(49.79822, -97.4592);
|
||||
const point5 = new LatLonNvectorSpherical(49.7981, -97.41371);
|
||||
const point6 = new LatLonNvectorSpherical(49.76851, -97.41371);
|
||||
const point7 = new LatLonNvectorSpherical(49.76873, -97.45954);
|
||||
const point8 = new LatLonNvectorSpherical(49.78846, -97.44306);
|
||||
point3.toNvector(); // Vector3d { x: -0.08363305717526297, y: -0.6401716454146233, z: 0.7636660108677438 }
|
||||
point3.greatCircle(45); // Vector3d { x: -0.6311975610221534, y: 0.6270426835846277, z: 0.45651627782881243 }
|
||||
point3.distanceTo(point4, 6371e3); // 1587.463492544562 m
|
||||
point3.bearingTo(point4); // 313.1353494923952 deg
|
||||
point3.initialBearingTo(point4); // 313.1353494923952 deg
|
||||
point3.midpointTo(point4); // LatLon { lat: 49.79334028019261, lon: -97.45112918683637 }
|
||||
point3.intermediatePointTo(point4, 0.25); // LatLon { lat: 49.79090021013134, lon: -97.44709439015365 }
|
||||
point3.intermediatePointOnChordTo(point4, 0.5); // LatLon { lat: 49.7933402801926, lon: -97.45112918683637 }
|
||||
point3.intermediatePointTo(point4, 0.5); // LatLon { lat: 49.7933402801926, lon: -97.45112918683637 }
|
||||
point3.destinationPoint(100, 0, 6371e3); // LatLon { lat: 49.78935932160593, lon: -97.44306000000003 }
|
||||
point3.crossTrackDistanceTo(point4, point5, 6371e3); // 1080.7461902301488 m
|
||||
point3.crossTrackDistanceTo(point4, 60, 6371e3); // 1519.091945034438 m
|
||||
point3.alongTrackDistanceTo(point4, point5, 6371e3); // 1162.7673995854138 m
|
||||
point3.alongTrackDistanceTo(point4, 60, 6371e3); // 460.86875216457025 m
|
||||
point3.nearestPointOnSegment(point4, point5); // LatLon { lat: 49.79817930627353, lon: -97.44299978937423 }
|
||||
point3.isBetween(point4, point5); // true
|
||||
point3.isWithinExtent(point4, point5); // true
|
||||
|
||||
const boundary = [point4, point5, point6, point7];
|
||||
point3.enclosedBy(boundary); // true
|
||||
point3.isEnclosedBy(boundary); // true
|
||||
point3.equals(point4); // false
|
||||
point3.equals(point8); // true
|
||||
point3.toString('dms', 3); // 49°47′18.456″N, 097°26′35.016″W
|
||||
point3.toString('dms', 2); // 49°47′18.456″N, 097°26′35.016″W
|
||||
|
||||
// Static functions
|
||||
LatLonVectors.intersection(point4, point5, point3, 1); // LatLon { lat: 49.7981787830497, lon: -97.44279718554108 }
|
||||
LatLonVectors.areaOf(boundary, 6371e3); // 10768180.94129682 m^2
|
||||
LatLonVectors.meanOf(boundary); // LatLon { lat: 49.783392242641824, lon: -97.43653998581752 }
|
||||
LatLonNvectorSpherical.intersection(point4, point5, point3, 1); // LatLon { lat: 49.7981787830497, lon: -97.44279718554108 }
|
||||
LatLonNvectorSpherical.areaOf(boundary, 6371e3); // 10768180.94129682 m^2
|
||||
LatLonNvectorSpherical.meanOf(boundary); // LatLon { lat: 49.783392242641824, lon: -97.43653998581752 }
|
||||
|
||||
215
types/geodesy/index.d.ts
vendored
215
types/geodesy/index.d.ts
vendored
@@ -1,34 +1,31 @@
|
||||
// Type definitions for geodesy 1.2
|
||||
// Type definitions for geodesy 2.2
|
||||
// Project: https://github.com/chrisveness/geodesy, http://www.movable-type.co.uk/scripts/geodesy-library.html
|
||||
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
|
||||
// Gilbert Handy <https://github.com/HandyG52>
|
||||
// Harry Nicholls <https://github.com/excelulous>
|
||||
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
|
||||
// Gilbert Handy <https://github.com/HandyG52>
|
||||
// Harry Nicholls <https://github.com/excelulous>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export type format = 'd' | 'dm' | 'dms';
|
||||
export type datum = 'ED50'| 'Irl1975'| 'NAD27'| 'NAD83'| 'NTF'| 'OSGB36'| 'Potsdam'| 'TokyoJapan'| 'WGS72'| 'WGS84';
|
||||
export type hemisphere = 'N' | 'S';
|
||||
export type ellipsoid = 'WGS84' | 'Airy1830' | 'AiryModified' | 'Bessel1841' | 'Clarke1866' | 'Clarke1880IGN' | 'GRS80' | 'Intl1924' | 'WGS72';
|
||||
export type transform = [number, number, number, number, number, number, number];
|
||||
export type LatLon = LatLonEllipsoidal;
|
||||
// TypeScript Version: 3.6
|
||||
|
||||
/*
|
||||
* @format
|
||||
*/
|
||||
|
||||
export type Format = 'd' | 'dm' | 'dms';
|
||||
export type Dp = 0 | 2 | 4;
|
||||
|
||||
export interface Plural<T> {
|
||||
[itemName: string]: T;
|
||||
}
|
||||
|
||||
export type Transform = [number, number, number, number, number, number, number];
|
||||
|
||||
export interface Datum {
|
||||
ellipsoid: Ellipsoid;
|
||||
transform: [number, number, number, number, number, number, number];
|
||||
transform: Transform;
|
||||
}
|
||||
|
||||
export interface Datums {
|
||||
ED50: Datum;
|
||||
Irl1975: Datum;
|
||||
NAD27: Datum;
|
||||
NAD83: Datum;
|
||||
NTF: Datum;
|
||||
OSGB36: Datum;
|
||||
Potsdam: Datum;
|
||||
TokyoJapan: Datum;
|
||||
WGS72: Datum;
|
||||
WGS84: Datum;
|
||||
}
|
||||
export type Datums = Plural<Datum>;
|
||||
|
||||
export interface Ellipsoid {
|
||||
a: number;
|
||||
@@ -36,160 +33,24 @@ export interface Ellipsoid {
|
||||
f: number;
|
||||
}
|
||||
|
||||
export interface Ellipsoids {
|
||||
WGS84: Ellipsoid;
|
||||
GRS80: Ellipsoid;
|
||||
Airy1830: Ellipsoid;
|
||||
AiryModified: Ellipsoid;
|
||||
Intl1924: Ellipsoid;
|
||||
Bessel1841: Ellipsoid;
|
||||
export type Ellipsoids = Plural<Ellipsoid>;
|
||||
|
||||
export interface GeoJSON {
|
||||
type: string;
|
||||
coordinates: [number, number];
|
||||
}
|
||||
|
||||
export class Mgrs {
|
||||
zone: number;
|
||||
band: string;
|
||||
e100k: string;
|
||||
n100k: string;
|
||||
easting: number;
|
||||
northing: number;
|
||||
datum: datum;
|
||||
latBands: string;
|
||||
e100kLetters: string;
|
||||
n100kLetters: string;
|
||||
constructor(
|
||||
zone: number,
|
||||
band: string,
|
||||
e100k: string,
|
||||
n100k: string,
|
||||
easting: number,
|
||||
northing: number,
|
||||
datum?: datum
|
||||
)
|
||||
static parse(mgrsGridRef: string): Mgrs;
|
||||
toUtm(): Utm;
|
||||
toString(digits?: 2 | 4 | 6 | 8 | 10): string;
|
||||
}
|
||||
export type Polygon<T> = T[];
|
||||
|
||||
export class Utm {
|
||||
zone: number;
|
||||
hemisphere: hemisphere;
|
||||
easting: number;
|
||||
northing: number;
|
||||
datum: Datum;
|
||||
convergence: number;
|
||||
scale: number;
|
||||
constructor(
|
||||
zone: number,
|
||||
hemisphere: hemisphere,
|
||||
easting: number,
|
||||
northing: number,
|
||||
datum?: datum,
|
||||
convergence?: number,
|
||||
scale?: number
|
||||
);
|
||||
static parse(utmCoord: string, datum?: datum): Utm;
|
||||
toLatLonE(): LatLon;
|
||||
toMgrs(): Mgrs;
|
||||
toString(digits?: number): string;
|
||||
}
|
||||
|
||||
export namespace Dms {
|
||||
let separator: string;
|
||||
function parseDMS(dmsStr: string): number;
|
||||
function toDMS(deg: number, format?: format, dp?: 0 | 2 | 4): string;
|
||||
function toLat(deg: number, format?: format, dp?: 0 | 2 | 4): string;
|
||||
function toLon(deg: number, format?: format, dp?: 0 | 2 | 4): string;
|
||||
function toBrng(deg: number, format?: format, dp?: 0 | 2 | 4): string;
|
||||
function compassPoint(bearing: number, precision?: 1 | 2 | 3): string;
|
||||
}
|
||||
|
||||
export class Vector3d {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
constructor(x: number, y: number, z: number);
|
||||
plus(v: Vector3d): Vector3d;
|
||||
minus(v: Vector3d): Vector3d;
|
||||
times(x: number): Vector3d;
|
||||
dividedBy(x: number): Vector3d;
|
||||
dot(v: Vector3d): number;
|
||||
cross(v: Vector3d): Vector3d;
|
||||
negate(): Vector3d;
|
||||
length(): number;
|
||||
unit(): Vector3d;
|
||||
angleTo(v: Vector3d, n?: Vector3d): number;
|
||||
rotateAround(axis: Vector3d, theta: number): Vector3d;
|
||||
toString(precision?: number): string;
|
||||
toLatLonE(datum: Datum): LatLon;
|
||||
applyTransform(t: number[]): Vector3d;
|
||||
}
|
||||
|
||||
export class OsGridRef {
|
||||
easting: number;
|
||||
northing: number;
|
||||
constructor(easting: number, northing: number);
|
||||
static latLonToOsGrid(p: LatLon): OsGridRef;
|
||||
static osGridToLatLon(gridref: OsGridRef, datum?: Datum): LatLon;
|
||||
static parse(gridref: string): OsGridRef;
|
||||
toString(digits?: number): string;
|
||||
}
|
||||
|
||||
export class LatLonEllipsoidal {
|
||||
lat: number;
|
||||
lon: number;
|
||||
datum: Datum;
|
||||
constructor(lat: number, lon: number, datum?: Datum);
|
||||
toUtm(): Utm;
|
||||
convertDatum(toDatum: Datum): LatLon;
|
||||
toCartesian(): Vector3d;
|
||||
toString(format?: format, dp?: 0 | 2 | 4): string;
|
||||
static datum: Datums;
|
||||
static ellipsoid: Ellipsoids;
|
||||
}
|
||||
|
||||
export class LatLonSpherical {
|
||||
lat: number;
|
||||
lon: number;
|
||||
constructor(lat: number, lon: number)
|
||||
distanceTo(point: LatLonSpherical, radius?: number): number;
|
||||
bearingTo(point: LatLonSpherical): number;
|
||||
finalBearingTo(point: LatLonSpherical): number;
|
||||
midpointTo(point: LatLonSpherical): number;
|
||||
intermediatePointTo(point: LatLonSpherical, fraction: number): LatLonSpherical;
|
||||
destinationPoint(distance: number, bearing: number, radius?: number): LatLonSpherical;
|
||||
static intersection(point1: LatLonSpherical, bearing1: number, point2: LatLonSpherical, bearing2: number): LatLonSpherical;
|
||||
crossTrackDistanceTo(pathStart: LatLonSpherical, pathEnd: LatLonSpherical, radius?: number): number;
|
||||
maxLatitude(bearing: number): number;
|
||||
static crossingParallels(point1: LatLonSpherical, point2: LatLonSpherical, latitude: number): any;
|
||||
rhumbDistanceTo(point: LatLonSpherical, radius?: number): number;
|
||||
rhumbBearingTo(point: LatLonSpherical): number;
|
||||
rhumbDestinationPoint(distance: number, bearing: number, radius?: number): LatLonSpherical;
|
||||
rhumbMidpointTo(point: LatLonSpherical): LatLonSpherical;
|
||||
equals(point: LatLonSpherical): boolean;
|
||||
static areaOf(polygon: LatLonSpherical[], radius?: number): number;
|
||||
toString(format?: string, dp?: number): string;
|
||||
}
|
||||
|
||||
export class LatLonVectors {
|
||||
lat: number;
|
||||
lon: number;
|
||||
constructor(lat: number, lon: number);
|
||||
toVector(): Vector3d;
|
||||
greatCircle(bearing: number): Vector3d;
|
||||
distanceTo(point: LatLonVectors, radius?: number): number;
|
||||
bearingTo(point: LatLonVectors): number;
|
||||
midpointTo(point: LatLonVectors): number;
|
||||
intermediatePointTo(point: LatLonVectors, fraction: number): LatLonVectors;
|
||||
intermediatePointOnChordTo(point: LatLonVectors, fraction: number): LatLonVectors;
|
||||
destinationPoint(distance: number, bearing: number, radius?: number): LatLonVectors;
|
||||
static intersection(path1start: LatLonVectors, path1brngEnd: LatLonVectors | number, path2start: LatLonVectors, path2brngEnd: LatLonVectors | number): LatLonVectors;
|
||||
crossTrackDistanceTo(pathStart: LatLonVectors, pathBrngEnd: LatLonVectors | number, radius?: number): number;
|
||||
alongTrackDistanceTo(pathStart: LatLonVectors, pathBrngEnd: LatLonVectors | number, radius?: number): number;
|
||||
nearestPointOnSegment(point1: LatLonVectors, point2: LatLonVectors): LatLonVectors;
|
||||
isBetween(point1: LatLonVectors, point2: LatLonVectors): boolean;
|
||||
enclosedBy(polygon: LatLonVectors[]): boolean;
|
||||
static areaOf(polygon: LatLonVectors[], radius?: number): number;
|
||||
static meanOf(points: ReadonlyArray<LatLonVectors>): LatLonVectors;
|
||||
equals(point: LatLonVectors): boolean;
|
||||
toString(format?: string, dp?: number): string;
|
||||
}
|
||||
import './latlon-ellipsoidal-datum';
|
||||
import './dms';
|
||||
import './latlon-ellipsoidal-referenceframe';
|
||||
import './latlon-ellipsoidal-vincenty';
|
||||
import './latlon-ellipsoidal';
|
||||
import './latlon-nvector-ellipsoidal';
|
||||
import './latlon-nvector-spherical';
|
||||
import './latlon-spherical';
|
||||
import './mgrs';
|
||||
import './osgridref';
|
||||
import './utm';
|
||||
import './vector3d';
|
||||
|
||||
39
types/geodesy/latlon-ellipsoidal-datum.d.ts
vendored
Normal file
39
types/geodesy/latlon-ellipsoidal-datum.d.ts
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import { Datum, Datums, Ellipsoids } from '.';
|
||||
|
||||
import LatLonEllipsoidal, { Cartesian, Dms } from './latlon-ellipsoidal';
|
||||
|
||||
declare const datums: Datums;
|
||||
|
||||
declare class LatLonEllipsoidal_Datum extends LatLonEllipsoidal {
|
||||
constructor(lat: number, lon: number, height?: number, datum?: Datum);
|
||||
get datum(): Datum;
|
||||
static get ellipsoids(): Ellipsoids;
|
||||
static get datums(): Datums;
|
||||
static parse(
|
||||
lat: number | string | object,
|
||||
lon?: number,
|
||||
height?: number,
|
||||
datum?: Datum,
|
||||
): LatLonEllipsoidal_Datum;
|
||||
convertDatum(toDatum: Datum): LatLonEllipsoidal_Datum;
|
||||
toCartesian(): Cartesian_Datum;
|
||||
}
|
||||
|
||||
declare class Cartesian_Datum extends Cartesian {
|
||||
constructor(x: number, y: number, z: number, datum?: Datum);
|
||||
get datum(): Datum;
|
||||
set datum(datum: Datum);
|
||||
toLatLon(): LatLonEllipsoidal_Datum;
|
||||
convertDatum(toDatum: Datum): Cartesian_Datum;
|
||||
}
|
||||
|
||||
export {
|
||||
LatLonEllipsoidal_Datum as default,
|
||||
Cartesian_Datum as Cartesian,
|
||||
datums,
|
||||
Dms,
|
||||
};
|
||||
53
types/geodesy/latlon-ellipsoidal-referenceframe.d.ts
vendored
Normal file
53
types/geodesy/latlon-ellipsoidal-referenceframe.d.ts
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import { Ellipsoid, Ellipsoids, Format, Dp, Plural } from '.';
|
||||
|
||||
import LatLonEllipsoidal, { Cartesian, Dms } from './latlon-ellipsoidal';
|
||||
|
||||
interface TxParam {
|
||||
epoch: string;
|
||||
params: [number, number, number, number, number, number];
|
||||
rates: [number, number, number, number, number, number];
|
||||
}
|
||||
|
||||
type TxParams = Plural<TxParam>;
|
||||
|
||||
interface ReferenceFrame {
|
||||
name: string;
|
||||
epoch: number;
|
||||
ellipsoid: Ellipsoid;
|
||||
}
|
||||
|
||||
type ReferenceFrames = Plural<ReferenceFrame>;
|
||||
|
||||
declare class LatLonEllipsoidal_ReferenceFrame extends LatLonEllipsoidal {
|
||||
constructor(lat: number, lon: number, height?: number, referenceFrame?: ReferenceFrame, epoch?: number);
|
||||
get referenceFrame(): ReferenceFrame;
|
||||
get epoch(): number;
|
||||
static get ellipsoids(): Ellipsoids;
|
||||
static get referenceFrames(): ReferenceFrames;
|
||||
static get transformParameters(): TxParams;
|
||||
static parse(
|
||||
lat: number | string | object,
|
||||
lon?: number,
|
||||
height?: number,
|
||||
referenceFrame?: ReferenceFrame,
|
||||
epoch?: number,
|
||||
): LatLonEllipsoidal_ReferenceFrame;
|
||||
convertReferenceFrame(toReferenceFrame: ReferenceFrame): LatLonEllipsoidal_ReferenceFrame;
|
||||
toCartesian(): Cartesian_ReferenceFrame;
|
||||
toString(format: Format, dp?: Dp, dpHeight?: number, referenceFrame?: ReferenceFrame): string;
|
||||
}
|
||||
|
||||
declare class Cartesian_ReferenceFrame extends Cartesian {
|
||||
constructor(x: number, y: number, z: number, referenceFrame?: ReferenceFrame, epoch?: number);
|
||||
get referenceFrame(): ReferenceFrame;
|
||||
get epoch(): number;
|
||||
toLatLon(): LatLonEllipsoidal_ReferenceFrame;
|
||||
convertReferenceFrame(toReferenceFrame: ReferenceFrame): Cartesian_ReferenceFrame;
|
||||
toString(dp?: number): string;
|
||||
}
|
||||
|
||||
export { LatLonEllipsoidal_ReferenceFrame as default, Cartesian_ReferenceFrame as Cartesian, Dms };
|
||||
31
types/geodesy/latlon-ellipsoidal-vincenty.d.ts
vendored
Normal file
31
types/geodesy/latlon-ellipsoidal-vincenty.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import LatLonEllipsoidal, { Dms } from './latlon-ellipsoidal';
|
||||
|
||||
declare class LatLonEllipsoidal_Vincenty extends LatLonEllipsoidal {
|
||||
distanceTo(point: LatLonEllipsoidal_Vincenty): number;
|
||||
initialBearingTo(point: LatLonEllipsoidal_Vincenty): number;
|
||||
finalBearingTo(point: LatLonEllipsoidal_Vincenty): number;
|
||||
destinationPoint(distance: number, initialBearing: number): LatLonEllipsoidal_Vincenty;
|
||||
finalBearingOn(distance: number, initialBearing: number): number;
|
||||
direct(
|
||||
distance: number,
|
||||
initialBearing: number,
|
||||
): {
|
||||
point: LatLonEllipsoidal_Vincenty;
|
||||
finalBearing: number;
|
||||
iterations: number;
|
||||
};
|
||||
inverse(
|
||||
point: LatLonEllipsoidal_Vincenty,
|
||||
): {
|
||||
distance: number;
|
||||
initialBearing: number;
|
||||
finalBearing: number;
|
||||
iterations: number;
|
||||
};
|
||||
}
|
||||
|
||||
export { LatLonEllipsoidal_Vincenty as default, Dms };
|
||||
42
types/geodesy/latlon-ellipsoidal.d.ts
vendored
Normal file
42
types/geodesy/latlon-ellipsoidal.d.ts
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import { Datum, Datums, Ellipsoid, Ellipsoids, Dp } from '.';
|
||||
import Dms from './dms';
|
||||
import Vector3d from './vector3d';
|
||||
|
||||
declare class LatLonEllipsoidal {
|
||||
_lat: number;
|
||||
_lon: number;
|
||||
_height: number;
|
||||
_datum: Datum;
|
||||
constructor(lat: number, lon: number, height?: number);
|
||||
get lat(): number;
|
||||
set lat(lat: number);
|
||||
get latitude(): number;
|
||||
set latitude(lat: number);
|
||||
get lon(): number;
|
||||
set lon(lon: number);
|
||||
get lng(): number;
|
||||
set lng(lon: number);
|
||||
get longitude(): number;
|
||||
set longitude(lon: number);
|
||||
get height(): number;
|
||||
set height(height: number);
|
||||
get datum(): Datum;
|
||||
set datum(datum: Datum);
|
||||
static get ellipsoids(): Ellipsoids;
|
||||
static get datums(): Datums;
|
||||
static parse(lat: number | string | object, lon?: number, height?: number): LatLonEllipsoidal;
|
||||
toCartesian(): Cartesian;
|
||||
equals(point: LatLonEllipsoidal): boolean;
|
||||
toString(format?: string, dp?: Dp, dpHeight?: number): string;
|
||||
}
|
||||
|
||||
declare class Cartesian extends Vector3d {
|
||||
toLatLon(ellipsoid: Ellipsoid): LatLonEllipsoidal;
|
||||
toString(dp?: number): string;
|
||||
}
|
||||
|
||||
export { LatLonEllipsoidal as default, Cartesian, Vector3d, Dms };
|
||||
42
types/geodesy/latlon-nvector-ellipsoidal.d.ts
vendored
Normal file
42
types/geodesy/latlon-nvector-ellipsoidal.d.ts
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import { Datum } from '.';
|
||||
|
||||
import LatLonEllipsoidal, { Cartesian, Vector3d, Dms } from './latlon-ellipsoidal';
|
||||
|
||||
declare class LatLon_NvectorEllipsoidal extends LatLonEllipsoidal {
|
||||
deltaTo(point: LatLon_NvectorEllipsoidal): Ned;
|
||||
destinationPoint(delta: Ned): LatLon_NvectorEllipsoidal;
|
||||
toNvector(): NvectorEllipsoidal;
|
||||
toCartesian(): Cartesian_Nvector;
|
||||
}
|
||||
|
||||
declare class NvectorEllipsoidal extends Vector3d {
|
||||
constructor(x: number, y: number, z: number, h?: number, datum?: Datum);
|
||||
toLatLon(): LatLon_NvectorEllipsoidal;
|
||||
toCartesian(): Cartesian_Nvector;
|
||||
toString(dp?: number, dpHeight?: number): string;
|
||||
}
|
||||
|
||||
declare class Cartesian_Nvector extends Cartesian {
|
||||
toNvector(datum: Datum): NvectorEllipsoidal;
|
||||
}
|
||||
|
||||
declare class Ned {
|
||||
constructor(north: number, east: number, down: number);
|
||||
get length(): number;
|
||||
get bearing(): number;
|
||||
get elevation(): number;
|
||||
static fromDistanceBearingElevation(dist: number, brng: number, elev: number): Ned;
|
||||
toString(dp?: number): string;
|
||||
}
|
||||
|
||||
export {
|
||||
LatLon_NvectorEllipsoidal as default,
|
||||
NvectorEllipsoidal as Nvector,
|
||||
Cartesian_Nvector as Cartesian,
|
||||
Ned,
|
||||
Dms,
|
||||
};
|
||||
74
types/geodesy/latlon-nvector-spherical.d.ts
vendored
Normal file
74
types/geodesy/latlon-nvector-spherical.d.ts
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import { GeoJSON, Format, Dp, Polygon } from '.';
|
||||
import Vector3d from './vector3d';
|
||||
import Dms from './dms';
|
||||
|
||||
type PathBrngEnd = LatLonNvectorSpherical | number;
|
||||
|
||||
declare class LatLonNvectorSpherical {
|
||||
constructor(lat: number, lon: number);
|
||||
get lat(): number;
|
||||
set lat(lat: number);
|
||||
get latitude(): number;
|
||||
set latitude(lat: number);
|
||||
get lon(): number;
|
||||
set lon(lon: number);
|
||||
get lng(): number;
|
||||
set lng(lon: number);
|
||||
get longitude(): number;
|
||||
set longitude(lon: number);
|
||||
static get metresToKm(): number;
|
||||
static get metresToMiles(): number;
|
||||
static get metresToNauticalMiles(): number;
|
||||
toNvector(): NvectorSpherical;
|
||||
greatCircle(bearing: number): Vector3d;
|
||||
distanceTo(point: LatLonNvectorSpherical, radius?: number): number;
|
||||
initialBearingTo(point: LatLonNvectorSpherical): number;
|
||||
finalBearingTo(point: LatLonNvectorSpherical): number;
|
||||
midpointTo(point: LatLonNvectorSpherical): LatLonNvectorSpherical;
|
||||
intermediatePointTo(point: LatLonNvectorSpherical, fraction: number): LatLonNvectorSpherical;
|
||||
destinationPoint(distance: number, bearing: number, radius?: number): LatLonNvectorSpherical;
|
||||
static intersection(
|
||||
path1start: LatLonNvectorSpherical,
|
||||
path1brngEnd: PathBrngEnd,
|
||||
path2start: LatLonNvectorSpherical,
|
||||
path2brngEnd: PathBrngEnd,
|
||||
): LatLonNvectorSpherical;
|
||||
crossTrackDistanceTo(pathStart: LatLonNvectorSpherical, pathBrngEnd: PathBrngEnd, radius?: number): number;
|
||||
alongTrackDistanceTo(pathStart: LatLonNvectorSpherical, pathBrngEnd: PathBrngEnd, radius?: number): number;
|
||||
nearestPointOnSegment(point1: LatLonNvectorSpherical, point2: LatLonNvectorSpherical): LatLonNvectorSpherical;
|
||||
isWithinExtent(point1: LatLonNvectorSpherical, point2: LatLonNvectorSpherical): boolean;
|
||||
static triangulate(
|
||||
point1: LatLonNvectorSpherical,
|
||||
bearing1: number,
|
||||
point2: LatLonNvectorSpherical,
|
||||
bearing2: number,
|
||||
): LatLonNvectorSpherical;
|
||||
static trilaterate(
|
||||
point1: LatLonNvectorSpherical,
|
||||
distance1: number,
|
||||
point2: LatLonNvectorSpherical,
|
||||
distance2: number,
|
||||
point3: LatLonNvectorSpherical,
|
||||
distance3: number,
|
||||
radius?: number,
|
||||
): LatLonNvectorSpherical;
|
||||
isEnclosedBy(polygon: Polygon<LatLonNvectorSpherical>): boolean;
|
||||
static areaOf(polygon: Polygon<LatLonNvectorSpherical>, radius?: number): number;
|
||||
static meanOf(points: Polygon<LatLonNvectorSpherical>): LatLonNvectorSpherical;
|
||||
equals(point: LatLonNvectorSpherical): boolean;
|
||||
toGeoJSON(): GeoJSON;
|
||||
toString(format?: Format, dp?: Dp): string;
|
||||
}
|
||||
|
||||
declare class NvectorSpherical extends Vector3d {
|
||||
constructor(x: number, y: number, z: number);
|
||||
toLatLon(): LatLonNvectorSpherical;
|
||||
greatCircle(bearing: number): Vector3d;
|
||||
toString(dp?: number): string;
|
||||
}
|
||||
|
||||
export { LatLonNvectorSpherical as default, NvectorSpherical as Nvector, Dms };
|
||||
52
types/geodesy/latlon-spherical.d.ts
vendored
Normal file
52
types/geodesy/latlon-spherical.d.ts
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import { Polygon, GeoJSON, Format, Dp } from '.';
|
||||
import Dms from './dms';
|
||||
|
||||
declare class LatLonSpherical {
|
||||
constructor(lat: number, lon: number);
|
||||
get lat(): number;
|
||||
set lat(lat: number);
|
||||
get latitude(): number;
|
||||
set latitude(lat: number);
|
||||
get lon(): number;
|
||||
set lon(lon: number);
|
||||
get lng(): number;
|
||||
set lng(lon: number);
|
||||
get longitude(): number;
|
||||
set longitude(lon: number);
|
||||
static get metresToKm(): number;
|
||||
static get metresToMiles(): number;
|
||||
static get metresToNauticalMiles(): number;
|
||||
static parse(lat: number | string | object, lon?: number): LatLonSpherical;
|
||||
distanceTo(point: LatLonSpherical, radius?: number): number;
|
||||
initialBearingTo(point: LatLonSpherical): number;
|
||||
finalBearingTo(point: LatLonSpherical): number;
|
||||
midpointTo(point: LatLonSpherical): LatLonSpherical;
|
||||
intermediatePointTo(point: LatLonSpherical, fraction: number): LatLonSpherical;
|
||||
destinationPoint(distance: number, bearing: number, radius?: number): LatLonSpherical;
|
||||
static intersection(p1: LatLonSpherical, brng1: number, p2: LatLonSpherical, brng2: number): LatLonSpherical | null;
|
||||
crossTrackDistanceTo(pathStart: LatLonSpherical, pathEnd: LatLonSpherical, radius?: number): number;
|
||||
alongTrackDistanceTo(pathStart: LatLonSpherical, pathEnd: LatLonSpherical, radius?: number): number;
|
||||
maxLatitude(bearing: number): number;
|
||||
static crossingParallels(
|
||||
point1: LatLonSpherical,
|
||||
point2: LatLonSpherical,
|
||||
latitude: number,
|
||||
): {
|
||||
lon1: number;
|
||||
lon2: number;
|
||||
} | null;
|
||||
rhumbDistanceTo(point: LatLonSpherical, radius?: number): number;
|
||||
rhumbBearingTo(point: LatLonSpherical): number;
|
||||
rhumbDestinationPoint(distance: number, bearing: number, radius?: number): LatLonSpherical;
|
||||
rhumbMidpointTo(point: LatLonSpherical): LatLonSpherical;
|
||||
static areaOf(polygon: Polygon<LatLonSpherical>, radius?: number): number;
|
||||
equals(point: LatLonSpherical): boolean;
|
||||
toGeoJSON(): GeoJSON;
|
||||
toString(format?: Format, dp?: Dp): string;
|
||||
}
|
||||
|
||||
export { LatLonSpherical as default, Dms };
|
||||
38
types/geodesy/mgrs.d.ts
vendored
Normal file
38
types/geodesy/mgrs.d.ts
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import { Datum } from '.';
|
||||
|
||||
import Utm, { LatLon as LatLonEllipsoidal, Dms } from './utm';
|
||||
|
||||
declare class Mgrs {
|
||||
zone: number;
|
||||
band: string;
|
||||
e100k: string;
|
||||
n100k: string;
|
||||
easting: number;
|
||||
northing: number;
|
||||
datum: Datum;
|
||||
constructor(
|
||||
zone: number,
|
||||
band: string,
|
||||
e100k: string,
|
||||
n100k: string,
|
||||
easting: number,
|
||||
northing: number,
|
||||
datum?: Datum,
|
||||
);
|
||||
static parse(mgrsGridRef: string): Mgrs;
|
||||
toUtm(): Utm_Mgrs;
|
||||
toString(digits?: 2 | 4 | 6 | 8 | 10): string;
|
||||
}
|
||||
|
||||
declare class Utm_Mgrs extends Utm {
|
||||
toMgrs(): Mgrs;
|
||||
}
|
||||
declare class Latlon_Utm_Mgrs extends LatLonEllipsoidal {
|
||||
toUtm(zoneOverride?: number): Utm_Mgrs;
|
||||
}
|
||||
|
||||
export { Mgrs as default, Utm_Mgrs as Utm, Latlon_Utm_Mgrs as LatLon, Dms };
|
||||
22
types/geodesy/osgridref.d.ts
vendored
Normal file
22
types/geodesy/osgridref.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import { Datum } from '.';
|
||||
|
||||
import LatLonEllipsoidal, { Dms } from './latlon-ellipsoidal-datum';
|
||||
|
||||
declare class OsGridRef {
|
||||
easting: number;
|
||||
northing: number;
|
||||
constructor(easting: number, northing: number);
|
||||
toLatLon(datum?: Datum): LatLon_OsGridRef;
|
||||
static parse(gridref: string): OsGridRef;
|
||||
toString(digits?: number): string;
|
||||
}
|
||||
|
||||
declare class LatLon_OsGridRef extends LatLonEllipsoidal {
|
||||
toOsGrid(): OsGridRef;
|
||||
}
|
||||
|
||||
export { OsGridRef as default, LatLon_OsGridRef as LatLon, Dms };
|
||||
@@ -17,7 +17,19 @@
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"dms.d.ts",
|
||||
"geodesy-tests.ts",
|
||||
"index.d.ts",
|
||||
"geodesy-tests.ts"
|
||||
"latlon-ellipsoidal-datum.d.ts",
|
||||
"latlon-ellipsoidal-referenceframe.d.ts",
|
||||
"latlon-ellipsoidal-vincenty.d.ts",
|
||||
"latlon-ellipsoidal.d.ts",
|
||||
"latlon-nvector-ellipsoidal.d.ts",
|
||||
"latlon-nvector-spherical.d.ts",
|
||||
"latlon-spherical.d.ts",
|
||||
"mgrs.d.ts",
|
||||
"osgridref.d.ts",
|
||||
"utm.d.ts",
|
||||
"vector3d.d.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
37
types/geodesy/utm.d.ts
vendored
Normal file
37
types/geodesy/utm.d.ts
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import { Datum } from '.';
|
||||
|
||||
import LatLonEllipsoidal, { Dms } from './latlon-ellipsoidal-datum';
|
||||
|
||||
type Hemisphere = 'N' | 'S';
|
||||
|
||||
declare class Utm {
|
||||
zone: number;
|
||||
hemisphere: Hemisphere;
|
||||
easting: number;
|
||||
northing: number;
|
||||
datum: Datum;
|
||||
convergence: number | null;
|
||||
scale: number | null;
|
||||
constructor(
|
||||
zone: number,
|
||||
hemisphere: Hemisphere,
|
||||
easting: number,
|
||||
northing: number,
|
||||
datum?: Datum,
|
||||
convergence?: number,
|
||||
scale?: number,
|
||||
);
|
||||
static parse(utmCoord: string, datum?: Datum): Utm;
|
||||
toLatLon(): LatLon_Utm;
|
||||
toString(digits?: number): string;
|
||||
}
|
||||
|
||||
declare class LatLon_Utm extends LatLonEllipsoidal {
|
||||
toUtm(zoneOverride?: number): Utm;
|
||||
}
|
||||
|
||||
export { Utm as default, LatLon_Utm as LatLon, Dms };
|
||||
24
types/geodesy/vector3d.d.ts
vendored
Normal file
24
types/geodesy/vector3d.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* @format
|
||||
*/
|
||||
|
||||
declare class Vector3d {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
constructor(x: number, y: number, z: number);
|
||||
get length(): number;
|
||||
plus(v: Vector3d): Vector3d;
|
||||
minus(v: Vector3d): Vector3d;
|
||||
times(x: number): Vector3d;
|
||||
dividedBy(x: number): Vector3d;
|
||||
dot(v: Vector3d): number;
|
||||
cross(v: Vector3d): Vector3d;
|
||||
negate(): Vector3d;
|
||||
unit(): Vector3d;
|
||||
angleTo(v: Vector3d, n?: Vector3d): number;
|
||||
rotateAround(axis: Vector3d, angle: number): Vector3d;
|
||||
toString(dp?: number): string;
|
||||
}
|
||||
|
||||
export default Vector3d;
|
||||
Reference in New Issue
Block a user