yarn add geo-position.ts
yarn test
or yarn test-nya
and for reports yarn report-test
import { GeoPosition } from 'geo-position.ts';
/* ... */
new GeoPosition(71.317941, 55.691416);
71.317941 //- Latitude (λ)
55.691416 //- Longitude (φ)
let xPoint = new GeoPosition(71.317941, 55.691416);
let yPoint = new GeoPosition(71.500873, 55.807184);
+xPoint.Distance(yPoint).toFixed(0) // -> 20844 meters
new GeoPosition(0, 0).IsZero() // -> true
new GeoPosition(71.317941, 55.691416) // -> false
GeoPosition.Zero.IsZero() // -> true
GeoPosition.IsValidGpsCoordinate(71.317941, 55.691416) // true
GeoPosition.IsValidGpsCoordinate(271.317941, 255.691416) // false
GeoPosition.GetGpsPosition("N71.317941", "E55.691416"); // -> [71.317941, 55.691416]
GeoPosition.GetGpsPosition("S71,317941", "W55,691416"); // -> [-71.317941, -55.691416]
let area = [
new GeoPosition(71.51834193441157, 55.116358997070286),
new GeoPosition(71.44676509856431, 54.92684483691404),
new GeoPosition(71.33845776024275, 55.123225452148404),
new GeoPosition(71.36701875276431, 55.43084263964841),
new GeoPosition(71.45113719694054, 55.575038196289),
new GeoPosition(71.5065763194486, 55.40749669238277),
new GeoPosition(71.51834193441157, 55.116358997070286)
]
new GeoPosition(71.436275, 55.220661).IsInsideArea(area) // true
new GeoPosition(0, 0).IsInsideArea(area) // false
let pos = new GeoPosition(71.436706, 55.268108);
let pos2 = new GeoPosition(71.473202, 55.857764);
GeoPosition.SectionCenterPosition(pos, pos2) // GeoPosition(71.454954, 55.562936)
let start = new GeoPosition(71.436706, 55.268108);
let end = new GeoPosition(71.473202, 55.857764);
let point = new GeoPosition(71.504361, 55.511926);
GeoPosition.SectionCenterPosition(point, start, end) // 5807 meters