@ulrik.ek/wgs84 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,21 +27,23 @@ const lon = 25;
27
27
  const p: wgs84.Point = wgs84.point(lat, lon);
28
28
 
29
29
  // Getting a new point 100m north and 200m east of the first point
30
- const p1: wgs84.Point = wgs84.pointEastOf(wgs84.pointNorthOf(p, 100), 200);
30
+ const p1: wgs84.Point = wgs84.pointEastOf(wgs84.pointNorthOf(p, 300), 400);
31
31
  const newLat = p1.coordinates[1]; // GeoJSON uses [lon, lat] order!
32
32
  const newLon = p1.coordinates[0];
33
33
  console.log(`lat=${newLat}, lon=${newLon}`);
34
34
 
35
35
  // get the distance along north between the 2 points
36
- console.log(`distance along north=${wgs84.distanceNorth(p, p1)}`);
37
- console.log(`distance along east=${wgs84.distanceEast(p, p1)}`);
36
+ console.log(`Distance along north=${wgs84.distanceNorth(p, p1)}`);
37
+ console.log(`Distance along east=${wgs84.distanceEast(p, p1)}`);
38
+ console.log(`Total distance=${wgs84.distance(p, p1)}`);
38
39
  ```
39
40
 
40
41
  This will produce the following output
41
42
 
42
- > lat=15.000903761214213, lon=25.001859599546577
43
- > distance along north=99.99999999991357
44
- > distance along east=200.00084005143466
43
+ > lat=15.002711283642645, lon=25.003719230339353
44
+ > Distance along north=300.00000000009265
45
+ > Distance along east=400.00504064747975
46
+ > Total distance=500.0040325271862
45
47
 
46
48
  ## Documention
47
49
 
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- export interface Point {
2
- type: 'Point';
3
- coordinates: number[];
4
- }
5
- export declare function point(lat: number, lon: number, height?: number): Point;
6
- export declare function R1(position: Point): number;
7
- export declare function R2(position: Point): number;
8
- export declare function distanceNorth(origin: Point, target: Point): number;
9
- export declare function distanceEast(origin: Point, target: Point): number;
10
- export declare function distanceUp(origin: Point, target: Point): number;
11
- export declare function distance(origin: Point, target: Point): number;
12
- export declare function bearing(origin: Point, target: Point): number;
13
- export declare function pointNorthOf(origin: Point, dN: number): Point;
14
- export declare function pointEastOf(origin: Point, dE: number): Point;
15
- export declare function pointAbove(origin: Point, dH: number): Point;
1
+ export interface Point {
2
+ type: 'Point';
3
+ coordinates: number[];
4
+ }
5
+ export declare function point(lat: number, lon: number, height?: number): Point;
6
+ export declare function R1(position: Point): number;
7
+ export declare function R2(position: Point): number;
8
+ export declare function distanceNorth(origin: Point, target: Point): number;
9
+ export declare function distanceEast(origin: Point, target: Point): number;
10
+ export declare function distanceUp(origin: Point, target: Point): number;
11
+ export declare function distance(origin: Point, target: Point): number;
12
+ export declare function bearing(origin: Point, target: Point): number;
13
+ export declare function pointNorthOf(origin: Point, dN: number): Point;
14
+ export declare function pointEastOf(origin: Point, dE: number): Point;
15
+ export declare function pointAbove(origin: Point, dH: number): Point;
package/dist/index.js CHANGED
@@ -1,142 +1,140 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pointAbove = exports.pointEastOf = exports.pointNorthOf = exports.bearing = exports.distance = exports.distanceUp = exports.distanceEast = exports.distanceNorth = exports.R2 = exports.R1 = exports.point = void 0;
4
- function point(lat, lon, height) {
5
- const result = height
6
- ? { coordinates: [lon, lat, height], type: 'Point' }
7
- : { coordinates: [lon, lat], type: 'Point' };
8
- validCoord(result);
9
- return result;
10
- }
11
- exports.point = point;
12
- const R = 6378.137 * 1000;
13
- const f = 1 / 298.257223563;
14
- const eSquared = f * (2 - f);
15
- function R1(position) {
16
- validCoord(position);
17
- const lat = degToRad(position.coordinates[1]);
18
- return (R * (1 - eSquared)) / Math.pow(1 - eSquared * Math.pow(Math.sin(lat), 2), 3 / 2);
19
- }
20
- exports.R1 = R1;
21
- function R2(position) {
22
- validCoord(position);
23
- const lat = degToRad(position.coordinates[1]);
24
- return R / Math.sqrt(1 - eSquared * Math.pow(Math.sin(lat), 2));
25
- }
26
- exports.R2 = R2;
27
- function distanceNorth(origin, target) {
28
- validCoord(origin);
29
- validCoord(target);
30
- const originLat = degToRad(origin.coordinates[1]);
31
- const targetLat = degToRad(target.coordinates[1]);
32
- return R1(origin) * (targetLat - originLat);
33
- }
34
- exports.distanceNorth = distanceNorth;
35
- function distanceEast(origin, target) {
36
- validCoord(origin);
37
- validCoord(target);
38
- const originLat = degToRad(origin.coordinates[1]);
39
- const originLon = degToRad(origin.coordinates[0]);
40
- const targetLon = degToRad(target.coordinates[0]);
41
- let deltaAngle = targetLon - originLon;
42
- if (deltaAngle > Math.PI) {
43
- deltaAngle -= 2 * Math.PI;
44
- }
45
- else if (targetLon - originLon < -Math.PI) {
46
- deltaAngle += 2 * Math.PI;
47
- }
48
- return R2(origin) * Math.cos(originLat) * deltaAngle;
49
- }
50
- exports.distanceEast = distanceEast;
51
- function distanceUp(origin, target) {
52
- if (origin.coordinates.length === 3 && target.coordinates.length === 3) {
53
- return target.coordinates[2] - origin.coordinates[2];
54
- }
55
- else {
56
- throw new Error('Input is not GeoJSON Point with height.');
57
- }
58
- }
59
- exports.distanceUp = distanceUp;
60
- function distance(origin, target) {
61
- if (origin.coordinates.length === 2 || target.coordinates.length === 2) {
62
- return Math.sqrt(distanceNorth(origin, target) ** 2 + distanceEast(origin, target) ** 2);
63
- }
64
- else if (origin.coordinates.length === 3 && target.coordinates.length === 3) {
65
- return Math.sqrt(distanceNorth(origin, target) ** 2 +
66
- distanceEast(origin, target) ** 2 +
67
- distanceUp(origin, target) ** 2);
68
- }
69
- else {
70
- throw new Error('Inputs are not GeoJSON Points.');
71
- }
72
- }
73
- exports.distance = distance;
74
- function bearing(origin, target) {
75
- validCoord(origin);
76
- validCoord(target);
77
- return ((radToDeg(Math.atan2(distanceEast(origin, target), distanceNorth(origin, target))) + 360) %
78
- 360);
79
- }
80
- exports.bearing = bearing;
81
- function pointNorthOf(origin, dN) {
82
- validCoord(origin);
83
- const lon = origin.coordinates[0];
84
- const lat = radToDeg(degToRad(origin.coordinates[1]) + dN / R1(origin));
85
- let result;
86
- if (origin.coordinates[2]) {
87
- const h = origin.coordinates[2];
88
- result = { coordinates: [lon, lat, h], type: 'Point' };
89
- }
90
- else {
91
- result = { coordinates: [lon, lat], type: 'Point' };
92
- }
93
- validCoord(result);
94
- return result;
95
- }
96
- exports.pointNorthOf = pointNorthOf;
97
- function pointEastOf(origin, dE) {
98
- validCoord(origin);
99
- const lat = origin.coordinates[1];
100
- let lon = radToDeg(degToRad(origin.coordinates[0]) + dE / (R2(origin) * Math.cos(degToRad(lat))));
101
- if (lon > 180) {
102
- lon -= 360;
103
- }
104
- else if (lon < -180) {
105
- lon += 360;
106
- }
107
- if (origin.coordinates[2]) {
108
- const h = origin.coordinates[2];
109
- return { coordinates: [lon, lat, h], type: 'Point' };
110
- }
111
- else {
112
- return { coordinates: [lon, lat], type: 'Point' };
113
- }
114
- }
115
- exports.pointEastOf = pointEastOf;
116
- function pointAbove(origin, dH) {
117
- validCoord(origin);
118
- return {
119
- coordinates: [origin.coordinates[0], origin.coordinates[1], origin.coordinates[2] + dH],
120
- type: 'Point'
121
- };
122
- }
123
- exports.pointAbove = pointAbove;
124
- function degToRad(deg) {
125
- return (deg * Math.PI) / 180;
126
- }
127
- function radToDeg(rad) {
128
- return (rad * 180) / Math.PI;
129
- }
130
- function validCoord(p) {
131
- if ((p.coordinates.length === 2 || p.coordinates.length === 3) &&
132
- -90 <= p.coordinates[1] &&
133
- p.coordinates[1] < 90 &&
134
- -180 <= p.coordinates[0] &&
135
- p.coordinates[0] <= 180) {
136
- return true;
137
- }
138
- else {
139
- throw new Error(`Invalid GeoJson or lat/lon out of range`);
140
- }
141
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pointAbove = exports.pointEastOf = exports.pointNorthOf = exports.bearing = exports.distance = exports.distanceUp = exports.distanceEast = exports.distanceNorth = exports.R2 = exports.R1 = exports.point = void 0;
4
+ function point(lat, lon, height) {
5
+ const result = height
6
+ ? { coordinates: [lon, lat, height], type: 'Point' }
7
+ : { coordinates: [lon, lat], type: 'Point' };
8
+ validCoord(result);
9
+ return result;
10
+ }
11
+ exports.point = point;
12
+ const R = 6378.137 * 1000;
13
+ const f = 1 / 298.257_223_563;
14
+ const eSquared = f * (2 - f);
15
+ function R1(position) {
16
+ validCoord(position);
17
+ const lat = degToRad(position.coordinates[1]);
18
+ return (R * (1 - eSquared)) / Math.pow(1 - eSquared * Math.pow(Math.sin(lat), 2), 3 / 2);
19
+ }
20
+ exports.R1 = R1;
21
+ function R2(position) {
22
+ validCoord(position);
23
+ const lat = degToRad(position.coordinates[1]);
24
+ return R / Math.sqrt(1 - eSquared * Math.pow(Math.sin(lat), 2));
25
+ }
26
+ exports.R2 = R2;
27
+ function distanceNorth(origin, target) {
28
+ validCoord(origin);
29
+ validCoord(target);
30
+ const originLat = degToRad(origin.coordinates[1]);
31
+ const targetLat = degToRad(target.coordinates[1]);
32
+ return R1(origin) * (targetLat - originLat);
33
+ }
34
+ exports.distanceNorth = distanceNorth;
35
+ function distanceEast(origin, target) {
36
+ validCoord(origin);
37
+ validCoord(target);
38
+ const originLat = degToRad(origin.coordinates[1]);
39
+ const originLon = degToRad(origin.coordinates[0]);
40
+ const targetLon = degToRad(target.coordinates[0]);
41
+ let deltaAngle = targetLon - originLon;
42
+ if (deltaAngle > Math.PI) {
43
+ deltaAngle -= 2 * Math.PI;
44
+ }
45
+ else if (targetLon - originLon < -Math.PI) {
46
+ deltaAngle += 2 * Math.PI;
47
+ }
48
+ return R2(origin) * Math.cos(originLat) * deltaAngle;
49
+ }
50
+ exports.distanceEast = distanceEast;
51
+ function distanceUp(origin, target) {
52
+ if (origin.coordinates.length === 3 && target.coordinates.length === 3) {
53
+ return target.coordinates[2] - origin.coordinates[2];
54
+ }
55
+ else {
56
+ throw new Error('Input is not GeoJSON Point with height.');
57
+ }
58
+ }
59
+ exports.distanceUp = distanceUp;
60
+ function distance(origin, target) {
61
+ if (origin.coordinates.length === 2 || target.coordinates.length === 2) {
62
+ return Math.hypot(distanceNorth(origin, target), distanceEast(origin, target));
63
+ }
64
+ else if (origin.coordinates.length === 3 && target.coordinates.length === 3) {
65
+ return Math.hypot(distanceNorth(origin, target), distanceEast(origin, target), distanceUp(origin, target));
66
+ }
67
+ else {
68
+ throw new Error('Inputs are not GeoJSON Points.');
69
+ }
70
+ }
71
+ exports.distance = distance;
72
+ function bearing(origin, target) {
73
+ validCoord(origin);
74
+ validCoord(target);
75
+ return ((radToDeg(Math.atan2(distanceEast(origin, target), distanceNorth(origin, target))) + 360) %
76
+ 360);
77
+ }
78
+ exports.bearing = bearing;
79
+ function pointNorthOf(origin, dN) {
80
+ validCoord(origin);
81
+ const lon = origin.coordinates[0];
82
+ const lat = radToDeg(degToRad(origin.coordinates[1]) + dN / R1(origin));
83
+ let result;
84
+ if (origin.coordinates[2]) {
85
+ const h = origin.coordinates[2];
86
+ result = { coordinates: [lon, lat, h], type: 'Point' };
87
+ }
88
+ else {
89
+ result = { coordinates: [lon, lat], type: 'Point' };
90
+ }
91
+ validCoord(result);
92
+ return result;
93
+ }
94
+ exports.pointNorthOf = pointNorthOf;
95
+ function pointEastOf(origin, dE) {
96
+ validCoord(origin);
97
+ const lat = origin.coordinates[1];
98
+ let lon = radToDeg(degToRad(origin.coordinates[0]) + dE / (R2(origin) * Math.cos(degToRad(lat))));
99
+ if (lon > 180) {
100
+ lon -= 360;
101
+ }
102
+ else if (lon < -180) {
103
+ lon += 360;
104
+ }
105
+ if (origin.coordinates[2]) {
106
+ const h = origin.coordinates[2];
107
+ return { coordinates: [lon, lat, h], type: 'Point' };
108
+ }
109
+ else {
110
+ return { coordinates: [lon, lat], type: 'Point' };
111
+ }
112
+ }
113
+ exports.pointEastOf = pointEastOf;
114
+ function pointAbove(origin, dH) {
115
+ validCoord(origin);
116
+ return {
117
+ coordinates: [origin.coordinates[0], origin.coordinates[1], origin.coordinates[2] + dH],
118
+ type: 'Point'
119
+ };
120
+ }
121
+ exports.pointAbove = pointAbove;
122
+ function degToRad(deg) {
123
+ return (deg * Math.PI) / 180;
124
+ }
125
+ function radToDeg(rad) {
126
+ return (rad * 180) / Math.PI;
127
+ }
128
+ function validCoord(p) {
129
+ if ((p.coordinates.length === 2 || p.coordinates.length === 3) &&
130
+ -90 <= p.coordinates[1] &&
131
+ p.coordinates[1] < 90 &&
132
+ -180 <= p.coordinates[0] &&
133
+ p.coordinates[0] <= 180) {
134
+ return true;
135
+ }
136
+ else {
137
+ throw new Error(`Invalid GeoJson or lat/lon out of range`);
138
+ }
139
+ }
142
140
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAiBA,SAAgB,KAAK,CAAC,GAAW,EAAE,GAAW,EAAE,MAAe;IAC3D,MAAM,MAAM,GAAU,MAAM;QACxB,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE;QACpD,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACjD,UAAU,CAAC,MAAM,CAAC,CAAC;IACnB,OAAO,MAAM,CAAC;AAClB,CAAC;AAND,sBAMC;AAGD,MAAM,CAAC,GAAW,QAAQ,GAAG,IAAI,CAAC;AAElC,MAAM,CAAC,GAAW,CAAC,GAAG,aAAe,CAAC;AAEtC,MAAM,QAAQ,GAAW,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAQrC,SAAgB,EAAE,CAAC,QAAe;IAC9B,UAAU,CAAC,QAAQ,CAAC,CAAC;IACrB,MAAM,GAAG,GAAG,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC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ACzB,CAAC;QACC,OAAO,IAAI,CAAC;IAChB,CAAC;SAAM,CAAC;QACJ,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC/D,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ulrik.ek/wgs84",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Basic library for computing small distances between WGS84 coordinates using a flat earth approximation.",
5
5
  "author": "Ulrik E.",
6
6
  "license": "MIT",
@@ -25,28 +25,28 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/geojson": "^7946.0.8",
28
- "@types/jest": "^27.4.1",
29
- "@types/node": "^17.0.23",
30
- "@typescript-eslint/eslint-plugin": "^5.16.0",
31
- "@typescript-eslint/parser": "^5.16.0",
32
- "eslint": "^8.12.0",
33
- "eslint-plugin-import": "^2.25.4",
34
- "eslint-plugin-jest": "26.1.3",
28
+ "@types/jest": "^29.5.12",
29
+ "@types/node": "^20.12.4",
30
+ "@typescript-eslint/eslint-plugin": "^7.5.0",
31
+ "@typescript-eslint/parser": "^7.5.0",
32
+ "eslint": "^8.57.0",
33
+ "eslint-plugin-import": "^2.29.1",
34
+ "eslint-plugin-jest": "^27.9.0",
35
35
  "eslint-plugin-json": "^3.1.0",
36
- "eslint-plugin-simple-import-sort": "^7.0.0",
37
- "eslint-plugin-sort-class-members": "^1.14.1",
36
+ "eslint-plugin-simple-import-sort": "^12.0.0",
37
+ "eslint-plugin-sort-class-members": "^1.20.0",
38
38
  "eslint-plugin-sort-keys-fix": "^1.1.2",
39
- "eslint-plugin-unicorn": "^41.0.1",
39
+ "eslint-plugin-unicorn": "^52.0.0",
40
40
  "eslint-plugin-yaml": "^0.5.0",
41
- "jest": "^27.5.1",
42
- "jest-junit": "^13.0.0",
43
- "prettier": "^2.6.1",
41
+ "jest": "^29.7.0",
42
+ "jest-junit": "^16.0.0",
43
+ "prettier": "^3.2.5",
44
44
  "shx": "^0.3.4",
45
- "ts-jest": "^27.1.4",
46
- "ts-node": "^10.7.0",
47
- "typedoc": "^0.22.13",
48
- "typedoc-plugin-markdown": "^3.11.14",
49
- "typescript": "^4.6.3"
45
+ "ts-jest": "^29.1.2",
46
+ "ts-node": "^10.9.2",
47
+ "typedoc": "^0.25.12",
48
+ "typedoc-plugin-markdown": "^3.17.1",
49
+ "typescript": "^5.4.4"
50
50
  },
51
51
  "types": "./dist/index.d.ts",
52
52
  "repository": {