@ulrik.ek/wgs84 1.0.1 → 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 +27 -8
- package/dist/index.d.ts +15 -15
- package/dist/index.js +139 -143
- package/dist/index.js.map +1 -1
- package/package.json +20 -20
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
A tiny library fully implemented in Typescript to handle WGS84 coordinates in GeoJson and "small" distances between them with very high accuracy (~1 cm), based on a local, flat earth approximation.
|
|
6
6
|
|
|
7
|
+
- All functions uses degrees for latitude and longitude, and meters for distances.
|
|
7
8
|
- Parses and gives output in GeoJson using the [Point definition](https://en.wikipedia.org/wiki/GeoJSON). If you already have imported the typescript definition for Point in the geojson package you can use that (that is what I do in unit testing). Otherwise you can import `Point` from this package.
|
|
8
9
|
- No dependencies to other NPM modules.
|
|
9
10
|
- The math is based on [Aviation Formulary V1.47 by Ed Williams](https://edwilliams.org/avform147.htm#flat).
|
|
@@ -18,7 +19,7 @@ Include in your project as any other NPM package
|
|
|
18
19
|
## Usage
|
|
19
20
|
|
|
20
21
|
```typescript
|
|
21
|
-
import * as wgs84 from '@ulrik.ek/wgs84';
|
|
22
|
+
import * as wgs84 from '@ulrik.ek/wgs84'; // The functions can obviously also be imported separately
|
|
22
23
|
|
|
23
24
|
// helper function to construct a GeoJSON Point
|
|
24
25
|
const lat = 15;
|
|
@@ -26,25 +27,43 @@ const lon = 25;
|
|
|
26
27
|
const p: wgs84.Point = wgs84.point(lat, lon);
|
|
27
28
|
|
|
28
29
|
// Getting a new point 100m north and 200m east of the first point
|
|
29
|
-
const p1: wgs84.Point = wgs84.pointEastOf(wgs84.pointNorthOf(p,
|
|
30
|
+
const p1: wgs84.Point = wgs84.pointEastOf(wgs84.pointNorthOf(p, 300), 400);
|
|
30
31
|
const newLat = p1.coordinates[1]; // GeoJSON uses [lon, lat] order!
|
|
31
32
|
const newLon = p1.coordinates[0];
|
|
32
33
|
console.log(`lat=${newLat}, lon=${newLon}`);
|
|
33
34
|
|
|
34
35
|
// get the distance along north between the 2 points
|
|
35
|
-
console.log(`
|
|
36
|
-
console.log(`
|
|
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)}`);
|
|
37
39
|
```
|
|
38
40
|
|
|
39
41
|
This will produce the following output
|
|
40
42
|
|
|
41
|
-
> lat=15.
|
|
42
|
-
>
|
|
43
|
-
>
|
|
43
|
+
> lat=15.002711283642645, lon=25.003719230339353
|
|
44
|
+
> Distance along north=300.00000000009265
|
|
45
|
+
> Distance along east=400.00504064747975
|
|
46
|
+
> Total distance=500.0040325271862
|
|
44
47
|
|
|
45
48
|
## Documention
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
The following functions are available:
|
|
51
|
+
|
|
52
|
+
```Typescript
|
|
53
|
+
point(lat: number, lon: number, height?: number): Point;
|
|
54
|
+
R1(position: Point): number;
|
|
55
|
+
R2(position: Point): number;
|
|
56
|
+
distanceNorth(origin: Point, target: Point): number;
|
|
57
|
+
distanceEast(origin: Point, target: Point): number;
|
|
58
|
+
distanceUp(origin: Point, target: Point): number;
|
|
59
|
+
distance(origin: Point, target: Point): number;
|
|
60
|
+
bearing(origin: Point, target: Point): number;
|
|
61
|
+
pointNorthOf(origin: Point, dN: number): Point;
|
|
62
|
+
pointEastOf(origin: Point, dE: number): Point;
|
|
63
|
+
pointAbove(origin: Point, dH: number): Point;
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
[Full Typedoc documentation](https://github.com/UEk/wgs84/blob/main/doc/modules.md)
|
|
48
67
|
|
|
49
68
|
# Build and Test
|
|
50
69
|
|
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,144 +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.
|
|
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
|
|
31
|
-
const
|
|
32
|
-
return R1(origin) * (
|
|
33
|
-
}
|
|
34
|
-
exports.distanceNorth = distanceNorth;
|
|
35
|
-
function distanceEast(origin, target) {
|
|
36
|
-
validCoord(origin);
|
|
37
|
-
validCoord(target);
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
let deltaAngle;
|
|
42
|
-
if (
|
|
43
|
-
deltaAngle
|
|
44
|
-
}
|
|
45
|
-
else if (
|
|
46
|
-
deltaAngle
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (origin.coordinates.length ===
|
|
65
|
-
return Math.
|
|
66
|
-
}
|
|
67
|
-
else
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
validCoord(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
else {
|
|
141
|
-
throw new Error(`Lat=$(lat)) or lon=$(lon) out of range`);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
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
|
+
}
|
|
144
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,
|
|
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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AAC;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.
|
|
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": "^
|
|
29
|
-
"@types/node": "^
|
|
30
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
31
|
-
"@typescript-eslint/parser": "^5.
|
|
32
|
-
"eslint": "^8.
|
|
33
|
-
"eslint-plugin-import": "^2.
|
|
34
|
-
"eslint-plugin-jest": "
|
|
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": "^
|
|
37
|
-
"eslint-plugin-sort-class-members": "^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": "^
|
|
39
|
+
"eslint-plugin-unicorn": "^52.0.0",
|
|
40
40
|
"eslint-plugin-yaml": "^0.5.0",
|
|
41
|
-
"jest": "^
|
|
42
|
-
"jest-junit": "^
|
|
43
|
-
"prettier": "^2.
|
|
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": "^
|
|
46
|
-
"ts-node": "^10.
|
|
47
|
-
"typedoc": "^0.
|
|
48
|
-
"typedoc-plugin-markdown": "^3.
|
|
49
|
-
"typescript": "^4.
|
|
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": {
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"url": "https://github.com/UEk/wgs84/issues"
|
|
58
58
|
},
|
|
59
59
|
"homepage": "https://github.com/UEk/wgs84#readme",
|
|
60
|
-
"keywords": ["wgs84", "geojson"]
|
|
60
|
+
"keywords": ["wgs84", "geojson", "latitude", "longitude"]
|
|
61
61
|
}
|