@mailwoman/spatial 4.16.2 → 5.1.0
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/bbox.ts +5 -7
- package/coordinate-formats.test.ts +1 -0
- package/coordinate-formats.ts +21 -7
- package/countries/names.ts +1 -1
- package/geometries/point.ts +12 -10
- package/geometries/polygon.test.ts +1 -0
- package/geometries/polygon.ts +33 -35
- package/google/place-id.ts +2 -2
- package/h3/index.ts +1 -0
- package/objects.ts +7 -8
- package/out/bbox.d.ts +5 -7
- package/out/bbox.d.ts.map +1 -1
- package/out/bbox.js +4 -5
- package/out/bbox.js.map +1 -1
- package/out/coordinate-formats.d.ts +6 -5
- package/out/coordinate-formats.d.ts.map +1 -1
- package/out/coordinate-formats.js +7 -7
- package/out/coordinate-formats.js.map +1 -1
- package/out/countries/names.d.ts +1 -1
- package/out/countries/names.js +1 -1
- package/out/geometries/point.d.ts +5 -10
- package/out/geometries/point.d.ts.map +1 -1
- package/out/geometries/point.js +2 -4
- package/out/geometries/point.js.map +1 -1
- package/out/geometries/polygon.d.ts +32 -35
- package/out/geometries/polygon.d.ts.map +1 -1
- package/out/geometries/polygon.js.map +1 -1
- package/out/google/place-id.d.ts +2 -2
- package/out/h3/index.d.ts.map +1 -1
- package/out/h3/index.js.map +1 -1
- package/out/objects.d.ts +7 -8
- package/out/objects.d.ts.map +1 -1
- package/out/objects.js.map +1 -1
- package/out/position.d.ts +10 -12
- package/out/position.d.ts.map +1 -1
- package/out/position.js +8 -10
- package/out/position.js.map +1 -1
- package/out/sdk/well-known-text.d.ts +3 -0
- package/out/sdk/well-known-text.d.ts.map +1 -1
- package/out/sdk/well-known-text.js +3 -0
- package/out/sdk/well-known-text.js.map +1 -1
- package/out/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/position.ts +10 -11
- package/sdk/well-known-text.test.ts +1 -0
- package/sdk/well-known-text.ts +3 -0
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/spatial",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Spatial analysis, geocoding, and other geo-related utilities.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"geo",
|
|
7
|
+
"spatial"
|
|
8
|
+
],
|
|
5
9
|
"license": "AGPL-3.0-only",
|
|
6
10
|
"contributors": [
|
|
7
11
|
{
|
|
@@ -21,15 +25,18 @@
|
|
|
21
25
|
"./sdk": "./out/sdk/index.js",
|
|
22
26
|
".": "./out/index.js"
|
|
23
27
|
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
24
31
|
"dependencies": {
|
|
25
|
-
"@mailwoman/core": "
|
|
32
|
+
"@mailwoman/core": "5.1.0",
|
|
26
33
|
"geo-coordinates-parser": "^1.7.4",
|
|
27
34
|
"h3-js": "^4.4.0",
|
|
28
35
|
"wkx": "^0.5.0"
|
|
29
36
|
},
|
|
30
37
|
"devDependencies": {
|
|
31
38
|
"@googlemaps/google-maps-services-js": "^3.4.2",
|
|
32
|
-
"@mailwoman/annotations": "
|
|
39
|
+
"@mailwoman/annotations": "5.1.0",
|
|
33
40
|
"@types/google.maps": "^3.65.1",
|
|
34
41
|
"type-fest": "^5.7.0"
|
|
35
42
|
},
|
|
@@ -39,12 +46,5 @@
|
|
|
39
46
|
},
|
|
40
47
|
"engines": {
|
|
41
48
|
"node": ">=24.18.0"
|
|
42
|
-
},
|
|
43
|
-
"keywords": [
|
|
44
|
-
"geo",
|
|
45
|
-
"spatial"
|
|
46
|
-
],
|
|
47
|
-
"publishConfig": {
|
|
48
|
-
"access": "public"
|
|
49
49
|
}
|
|
50
50
|
}
|
package/position.ts
CHANGED
|
@@ -12,8 +12,8 @@ import { GeoPoint, type GeoPointInput } from "@mailwoman/spatial"
|
|
|
12
12
|
/**
|
|
13
13
|
* An ordered pair of coordinates in the form of [longitude, latitude].
|
|
14
14
|
*
|
|
15
|
-
* Note that unlike the typical order, GeoJSON coordinates are in the order of [longitude, latitude]
|
|
16
|
-
*
|
|
15
|
+
* Note that unlike the typical order, GeoJSON coordinates are in the order of [longitude, latitude] to match the order
|
|
16
|
+
* of [x, y] in Cartesian coordinates.
|
|
17
17
|
*
|
|
18
18
|
* @category Position
|
|
19
19
|
* @category GeoJSON
|
|
@@ -61,8 +61,8 @@ export function orderGeoJSONToCoordPair([longitude, latitude]: Coordinates2D): [
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
* Given an input which appears to be reversed GeoJSON coordinates (i.e. [latitude, longitude]),
|
|
65
|
-
*
|
|
64
|
+
* Given an input which appears to be reversed GeoJSON coordinates (i.e. [latitude, longitude]), returns the coordinates
|
|
65
|
+
* in the correct order of [longitude, latitude].
|
|
66
66
|
*
|
|
67
67
|
* Note that this is a heuristic and is only accurate for North American coordinates.
|
|
68
68
|
*
|
|
@@ -176,6 +176,7 @@ export function isInterpolatedCoordinates(input: unknown): input is InternalPoin
|
|
|
176
176
|
if (!input || typeof input !== "object") return false
|
|
177
177
|
|
|
178
178
|
if (!("x" in input)) return false
|
|
179
|
+
|
|
179
180
|
if (!("y" in input)) return false
|
|
180
181
|
|
|
181
182
|
return typeof input.x === "number" && typeof input.y === "number"
|
|
@@ -265,14 +266,12 @@ export function haversine(point1: GeoPointInput, point2: GeoPointInput, unit: Ea
|
|
|
265
266
|
}
|
|
266
267
|
|
|
267
268
|
/**
|
|
268
|
-
* Great-circle distance in kilometres between two lat/lon pairs given as raw scalars. The formula's
|
|
269
|
-
*
|
|
270
|
-
* this instead of re-declaring it.
|
|
269
|
+
* Great-circle distance in kilometres between two lat/lon pairs given as raw scalars. The formula's one true home —
|
|
270
|
+
* every resolver + eval consumer of the `(aLat, aLon, bLat, bLon)` shape imports this instead of re-declaring it.
|
|
271
271
|
*
|
|
272
|
-
* Unlike {@link haversine}, this is pure math with NO Null-Island sentinel: `(0, 0)` is the Gulf of
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
* distance.
|
|
272
|
+
* Unlike {@link haversine}, this is pure math with NO Null-Island sentinel: `(0, 0)` is the Gulf of Guinea — a real
|
|
273
|
+
* point, not "missing coordinate". That sentinel convention belongs to the `GeoPointInput` object form (where a 0/0
|
|
274
|
+
* input means "no coordinate"), not to a raw scalar distance.
|
|
276
275
|
*
|
|
277
276
|
* @category Position
|
|
278
277
|
*/
|
package/sdk/well-known-text.ts
CHANGED
|
@@ -35,6 +35,7 @@ export function wellKnownGeometryToGeoJSON<T = GeometryLiteral>(input: Buffer |
|
|
|
35
35
|
* Given a GeoJSON geometry object, convert it to an well-known binary (EWKB) buffer.
|
|
36
36
|
*
|
|
37
37
|
* @category Geo
|
|
38
|
+
*
|
|
38
39
|
* @returns A hex-encoded EWKB string or WKB buffer.
|
|
39
40
|
*/
|
|
40
41
|
export function geometryToWKB(geometry: GeometryLiteral | GeometryCollection) {
|
|
@@ -45,6 +46,7 @@ export function geometryToWKB(geometry: GeometryLiteral | GeometryCollection) {
|
|
|
45
46
|
* Given a GeoJSON geometry object, convert it to an extended well-known binary (EWKB) buffer.
|
|
46
47
|
*
|
|
47
48
|
* @category Geo
|
|
49
|
+
*
|
|
48
50
|
* @returns A buffer representing the EWKB.
|
|
49
51
|
*/
|
|
50
52
|
export function geometryToEWKB(geometry: GeometryLiteral | GeometryCollection) {
|
|
@@ -55,6 +57,7 @@ export function geometryToEWKB(geometry: GeometryLiteral | GeometryCollection) {
|
|
|
55
57
|
* Given a GeoJSON geometry object, convert it to an extended well-known binary (EWKB) buffer.
|
|
56
58
|
*
|
|
57
59
|
* @category Geo
|
|
60
|
+
*
|
|
58
61
|
* @returns A hex-encoded string representing the EWKB.
|
|
59
62
|
*/
|
|
60
63
|
export function geometryToEWKH(geometry: GeometryLiteral | GeometryCollection) {
|