@mailwoman/spatial 9.1.0 → 9.3.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 → lib/bbox.ts} +54 -3
- package/lib/coordinate-bounds.ts +52 -0
- package/{coordinate-formats.ts → lib/coordinate-formats.ts} +16 -3
- package/lib/distance.ts +165 -0
- package/{feature.ts → lib/feature.ts} +1 -1
- package/{geometries → lib/geometries}/collection.ts +4 -4
- package/lib/geometries/index.ts +13 -0
- package/{geometries → lib/geometries}/line-string.ts +2 -2
- package/{geometries → lib/geometries}/point.ts +9 -9
- package/{geometries → lib/geometries}/polygon.ts +93 -89
- package/lib/geometries/ring-blob.ts +521 -0
- package/{google → lib/google}/index.ts +1 -1
- package/{h3 → lib/h3}/cell.ts +83 -1
- package/lib/h3/coverage.ts +45 -0
- package/{h3 → lib/h3}/index.ts +5 -3
- package/lib/h3/interior-cells.ts +138 -0
- package/lib/h3/polygon-cells.ts +462 -0
- package/lib/index.ts +21 -0
- package/{objects.ts → lib/objects.ts} +1 -1
- package/lib/open-location-code.ts +168 -0
- package/{osgb36.ts → lib/osgb36.ts} +2 -2
- package/{polyline.ts → lib/polyline.ts} +1 -1
- package/lib/position.ts +216 -0
- package/lib/projection-transform.ts +115 -0
- package/{regions → lib/regions}/codes.ts +1 -1
- package/{regions → lib/regions}/index.ts +2 -2
- package/lib/tools/ogr-stream.ts +99 -0
- package/lib/tools/ogr.ts +201 -0
- package/{sdk → lib}/well-known-text.ts +2 -1
- package/out/bbox.d.ts +23 -2
- package/out/bbox.d.ts.map +1 -1
- package/out/bbox.js +33 -2
- package/out/bbox.js.map +1 -1
- package/out/coordinate-bounds.d.ts +41 -0
- package/out/coordinate-bounds.d.ts.map +1 -0
- package/out/coordinate-bounds.js +45 -0
- package/out/coordinate-bounds.js.map +1 -0
- package/out/coordinate-formats.d.ts +8 -0
- package/out/coordinate-formats.d.ts.map +1 -1
- package/out/coordinate-formats.js +14 -3
- package/out/coordinate-formats.js.map +1 -1
- package/out/distance.d.ts +84 -0
- package/out/distance.d.ts.map +1 -0
- package/out/distance.js +132 -0
- package/out/distance.js.map +1 -0
- package/out/feature.d.ts +1 -1
- package/out/feature.d.ts.map +1 -1
- package/out/feature.js.map +1 -1
- package/out/geometries/collection.d.ts +4 -4
- package/out/geometries/collection.d.ts.map +1 -1
- package/out/geometries/collection.js.map +1 -1
- package/out/geometries/index.d.ts +5 -4
- package/out/geometries/index.d.ts.map +1 -1
- package/out/geometries/index.js +5 -4
- package/out/geometries/index.js.map +1 -1
- package/out/geometries/line-string.d.ts +2 -2
- package/out/geometries/line-string.d.ts.map +1 -1
- package/out/geometries/line-string.js.map +1 -1
- package/out/geometries/point.d.ts +9 -9
- package/out/geometries/point.d.ts.map +1 -1
- package/out/geometries/point.js +9 -9
- package/out/geometries/point.js.map +1 -1
- package/out/geometries/polygon.d.ts +60 -56
- package/out/geometries/polygon.d.ts.map +1 -1
- package/out/geometries/polygon.js +66 -63
- package/out/geometries/polygon.js.map +1 -1
- package/out/geometries/ring-blob.d.ts +183 -0
- package/out/geometries/ring-blob.d.ts.map +1 -0
- package/out/geometries/ring-blob.js +376 -0
- package/out/geometries/ring-blob.js.map +1 -0
- package/out/google/index.d.ts +1 -1
- package/out/google/index.d.ts.map +1 -1
- package/out/google/index.js +1 -1
- package/out/google/index.js.map +1 -1
- package/out/google/place-id.d.ts.map +1 -1
- package/out/google/place-id.js.map +1 -1
- package/out/h3/cell.d.ts +32 -0
- package/out/h3/cell.d.ts.map +1 -1
- package/out/h3/cell.js +68 -1
- package/out/h3/cell.js.map +1 -1
- package/out/h3/coverage.d.ts +32 -0
- package/out/h3/coverage.d.ts.map +1 -0
- package/out/h3/coverage.js +27 -0
- package/out/h3/coverage.js.map +1 -0
- package/out/h3/index.d.ts +5 -3
- package/out/h3/index.d.ts.map +1 -1
- package/out/h3/index.js +5 -3
- package/out/h3/index.js.map +1 -1
- package/out/h3/interior-cells.d.ts +54 -0
- package/out/h3/interior-cells.d.ts.map +1 -0
- package/out/h3/interior-cells.js +111 -0
- package/out/h3/interior-cells.js.map +1 -0
- package/out/h3/polygon-cells.d.ts +182 -0
- package/out/h3/polygon-cells.d.ts.map +1 -0
- package/out/h3/polygon-cells.js +339 -0
- package/out/h3/polygon-cells.js.map +1 -0
- package/out/index.d.ts +15 -12
- package/out/index.d.ts.map +1 -1
- package/out/index.js +15 -12
- package/out/index.js.map +1 -1
- package/out/objects.d.ts +1 -1
- package/out/objects.d.ts.map +1 -1
- package/out/objects.js +1 -1
- package/out/objects.js.map +1 -1
- package/out/open-location-code.d.ts +48 -0
- package/out/open-location-code.d.ts.map +1 -0
- package/out/open-location-code.js +137 -0
- package/out/open-location-code.js.map +1 -0
- package/out/osgb36.d.ts +2 -2
- package/out/osgb36.d.ts.map +1 -1
- package/out/osgb36.js +1 -1
- package/out/osgb36.js.map +1 -1
- package/out/polyline.d.ts.map +1 -1
- package/out/polyline.js +1 -1
- package/out/polyline.js.map +1 -1
- package/out/position.d.ts +4 -61
- package/out/position.d.ts.map +1 -1
- package/out/position.js +14 -126
- package/out/position.js.map +1 -1
- package/out/projection-transform.d.ts +67 -0
- package/out/projection-transform.d.ts.map +1 -0
- package/out/projection-transform.js +48 -0
- package/out/projection-transform.js.map +1 -0
- package/out/projection.d.ts.map +1 -1
- package/out/projection.js.map +1 -1
- package/out/regions/codes.d.ts.map +1 -1
- package/out/regions/codes.js.map +1 -1
- package/out/regions/index.d.ts +2 -2
- package/out/regions/index.d.ts.map +1 -1
- package/out/regions/index.js +2 -2
- package/out/regions/index.js.map +1 -1
- package/out/regions/names.d.ts.map +1 -1
- package/out/regions/names.js.map +1 -1
- package/out/tools/ogr-stream.d.ts +34 -0
- package/out/tools/ogr-stream.d.ts.map +1 -0
- package/out/tools/ogr-stream.js +74 -0
- package/out/tools/ogr-stream.js.map +1 -0
- package/out/tools/ogr.d.ts +87 -0
- package/out/tools/ogr.d.ts.map +1 -0
- package/out/tools/ogr.js +84 -0
- package/out/tools/ogr.js.map +1 -0
- package/out/tsconfig.test.tsbuildinfo +1 -1
- package/out/{sdk/well-known-text.d.ts → well-known-text.d.ts} +1 -1
- package/out/well-known-text.d.ts.map +1 -0
- package/out/well-known-text.js.map +1 -0
- package/package.json +143 -14
- package/geometries/index.ts +0 -12
- package/index.ts +0 -18
- package/out/sdk/index.d.ts +0 -7
- package/out/sdk/index.d.ts.map +0 -1
- package/out/sdk/index.js +0 -7
- package/out/sdk/index.js.map +0 -1
- package/out/sdk/well-known-text.d.ts.map +0 -1
- package/out/sdk/well-known-text.js.map +0 -1
- package/out/tsconfig.tsbuildinfo +0 -1
- package/position.ts +0 -345
- package/sdk/index.ts +0 -7
- /package/{google → lib/google}/place-id.ts +0 -0
- /package/{projection.ts → lib/projection.ts} +0 -0
- /package/{regions → lib/regions}/names.ts +0 -0
- /package/out/{sdk/well-known-text.js → well-known-text.js} +0 -0
package/out/distance.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software.
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file Great-circle distance utilities. This module imports geometry directly so spatial's
|
|
6
|
+
* lowest-level math never reaches back through its public barrel.
|
|
7
|
+
*/
|
|
8
|
+
import { GeoPoint } from "#geometries/point";
|
|
9
|
+
import { arealPolygons } from "#geometries/polygon";
|
|
10
|
+
/**
|
|
11
|
+
* Conversion factors for converting between degrees and radians.
|
|
12
|
+
*
|
|
13
|
+
* @category Position
|
|
14
|
+
* @see {@link https://en.wikipedia.org/wiki/Radian Wikipedia: Radian}
|
|
15
|
+
* @see {@link https://en.wikipedia.org/wiki/Degree_(angle) Wikipedia: Degree (angle)}
|
|
16
|
+
*/
|
|
17
|
+
export const ConversionFactor = {
|
|
18
|
+
DegreesToRadians: Math.PI / 180,
|
|
19
|
+
RadiansToDegrees: 180 / Math.PI,
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Radius of the Earth in various units.
|
|
23
|
+
*/
|
|
24
|
+
const RADII = {
|
|
25
|
+
km: 6371,
|
|
26
|
+
miles: 3958.8,
|
|
27
|
+
meters: 6_371_000,
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Shared great-circle math with no sentinel handling. `unit` selects the Earth radius.
|
|
31
|
+
*/
|
|
32
|
+
function greatCircle(lat1, lon1, lat2, lon2, unit) {
|
|
33
|
+
const dLat = (lat2 - lat1) * ConversionFactor.DegreesToRadians;
|
|
34
|
+
const dLon = (lon2 - lon1) * ConversionFactor.DegreesToRadians;
|
|
35
|
+
const a = Math.pow(Math.sin(dLat / 2), 2) +
|
|
36
|
+
Math.cos(lat1 * ConversionFactor.DegreesToRadians) *
|
|
37
|
+
Math.cos(lat2 * ConversionFactor.DegreesToRadians) *
|
|
38
|
+
Math.pow(Math.sin(dLon / 2), 2);
|
|
39
|
+
return RADII[unit] * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Calculate the distance between two points on the Earth's surface.
|
|
43
|
+
*
|
|
44
|
+
* @category Position
|
|
45
|
+
* @param point1 The first point to calculate the distance from.
|
|
46
|
+
* @param point2 The second point to calculate the distance to.
|
|
47
|
+
* @param unit The unit of measurement to return the distance in.
|
|
48
|
+
*
|
|
49
|
+
* @returns The distance between the two points in the specified unit.
|
|
50
|
+
*/
|
|
51
|
+
export function haversine(point1, point2, unit = "km") {
|
|
52
|
+
const p1 = GeoPoint.from(point1);
|
|
53
|
+
const p2 = GeoPoint.from(point2);
|
|
54
|
+
if (!p1 || !p2)
|
|
55
|
+
return Number.NaN;
|
|
56
|
+
return greatCircle(p1.latitude, p1.longitude, p2.latitude, p2.longitude, unit);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Great-circle distance in kilometres between two lat/lon pairs given as raw scalars. The formula's one true home —
|
|
60
|
+
* every resolver + eval consumer of the `(aLat, aLon, bLat, bLon)` shape imports this instead of re-declaring it.
|
|
61
|
+
*
|
|
62
|
+
* Unlike {@link haversine}, this is pure math with NO Null-Island sentinel: `(0, 0)` is the Gulf of Guinea — a real
|
|
63
|
+
* point, not "missing coordinate". That sentinel convention belongs to the `GeoPointInput` object form (where a 0/0
|
|
64
|
+
* input means "no coordinate"), not to a raw scalar distance.
|
|
65
|
+
*
|
|
66
|
+
* @category Position
|
|
67
|
+
*/
|
|
68
|
+
export function haversineKm(aLat, aLon, bLat, bLon) {
|
|
69
|
+
return greatCircle(aLat, aLon, bLat, bLon, "km");
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Metres per degree of latitude — the scale {@link segmentDistanceMetres} reports in, and the constant the bounding-box
|
|
73
|
+
* estimates in `#h3/polygon-cells` are built on.
|
|
74
|
+
*/
|
|
75
|
+
export const METRES_PER_DEGREE = 111_320;
|
|
76
|
+
/**
|
|
77
|
+
* Square metres in a square kilometre — the conversion every polygon layer's area receipt reports through.
|
|
78
|
+
*/
|
|
79
|
+
export const M2_PER_KM2 = 1_000_000;
|
|
80
|
+
/**
|
|
81
|
+
* Metres from a point to a line SEGMENT, with longitude scaled for the latitude so the two axes are comparable.
|
|
82
|
+
*
|
|
83
|
+
* MEASURE TO THE EDGE, NOT TO THE NEAREST VERTEX. A point a centimetre from a long edge can be metres from every vertex
|
|
84
|
+
* of it, so a vertex distance overstates the gap without bound — measured on the flood layer's verification, one
|
|
85
|
+
* near-miss read 1.58 m to vertices and 0.009 m to edges, a 9 mm difference overstated 175-fold. That is the difference
|
|
86
|
+
* between "two channels rendered the same edge slightly differently" and "the conversion is wrong".
|
|
87
|
+
*
|
|
88
|
+
* The longitude scaling matters at the same scale: comparing raw degrees treats a degree of longitude as a degree of
|
|
89
|
+
* latitude, which at 54°N overstates east-west distance by 70%.
|
|
90
|
+
*
|
|
91
|
+
* @category Position
|
|
92
|
+
*/
|
|
93
|
+
export function segmentDistanceMetres(lon, lat, from, to) {
|
|
94
|
+
const scale = Math.cos((lat * Math.PI) / 180);
|
|
95
|
+
const px = (lon - from[0]) * scale;
|
|
96
|
+
const py = lat - from[1];
|
|
97
|
+
const vx = (to[0] - from[0]) * scale;
|
|
98
|
+
const vy = to[1] - from[1];
|
|
99
|
+
const lengthSquared = vx * vx + vy * vy;
|
|
100
|
+
// A zero-length segment is a repeated vertex; the distance to it is the distance to the point.
|
|
101
|
+
const t = lengthSquared === 0 ? 0 : Math.max(0, Math.min(1, (px * vx + py * vy) / lengthSquared));
|
|
102
|
+
return Math.hypot(px - t * vx, py - t * vy) * METRES_PER_DEGREE;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Metres from a point to the nearest ring EDGE of an areal geometry — `Infinity` when the geometry bounds no area or
|
|
106
|
+
* carries no segment.
|
|
107
|
+
*
|
|
108
|
+
* To the edge, not to the nearest vertex: a point a centimetre from a long edge can be metres from every vertex of it,
|
|
109
|
+
* so a vertex distance overstates the gap without bound — measured on the flood layer's verification, one near-miss
|
|
110
|
+
* read 1.58 m to vertices and 0.009 m to edges, a 9 mm difference overstated 175-fold. Every polygon layer's two-path
|
|
111
|
+
* verification measures its boundary tolerance with this.
|
|
112
|
+
*
|
|
113
|
+
* @category Position
|
|
114
|
+
*/
|
|
115
|
+
export function nearestRingEdgeMetres(geometry, longitude, latitude) {
|
|
116
|
+
const polygons = arealPolygons(geometry);
|
|
117
|
+
let nearest = Infinity;
|
|
118
|
+
if (!polygons)
|
|
119
|
+
return nearest;
|
|
120
|
+
for (const rings of polygons) {
|
|
121
|
+
for (const ring of rings) {
|
|
122
|
+
for (let index = 1; index < ring.length; index++) {
|
|
123
|
+
const distance = segmentDistanceMetres(longitude, latitude, ring[index - 1], ring[index]);
|
|
124
|
+
if (distance < nearest) {
|
|
125
|
+
nearest = distance;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return nearest;
|
|
131
|
+
}
|
|
132
|
+
//# source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AAE,IAAI,CAAC,KAAK,CAAE,CAAC,CAAA;gBAE3F,IAAI,QAAQ,GAAG,OAAO,EAAE,CAAC;oBACxB,OAAO,GAAG,QAAQ,CAAA;gBACnB,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,OAAO,CAAA;AACf,CAAC"}
|
package/out/feature.d.ts
CHANGED
package/out/feature.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../feature.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../lib/feature.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD,MAAM,WAAW,sBAAsB;IACtC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,eAAe,EAAE,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,KAAK;IAC/E;;OAEG;IACH,IAAI,EAAE,SAAS,CAAA;IACf;;;;OAIG;IACH,QAAQ,EAAE,CAAC,CAAA;IAEX;;OAEG;IACH,EAAE,CAAC,EAAE,CAAC,SAAS,sBAAsB,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,KAAK,CAAA;IAE1D;;OAEG;IACH,UAAU,EAAE,CAAC,CAAA;CACb;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAEnF;;GAEG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAErF;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,eAAe,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACpH;;OAEG;IACH,IAAI,EAAE,mBAAmB,CAAA;IAEzB;;OAEG;IACH,QAAQ,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAA;CAC5B;AAED;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,IACtC,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GACnC,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC1B,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,GACvC,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC1B,KAAK,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,SAAS,oBAAoB,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAE5F;;GAEG;AACH,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,UAAU,IAAI,oBAAoB,CAC/E,mBAAmB,CAAC,CAAC,CAAC,EACtB,qBAAqB,CAAC,CAAC,CAAC,CACxB,CAAA"}
|
package/out/feature.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.js","sourceRoot":"","sources":["../feature.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
1
|
+
{"version":3,"file":"feature.js","sourceRoot":"","sources":["../lib/feature.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*
|
|
6
6
|
* GeoJSON Geometry Collection
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
8
|
+
import type { LineStringLiteral, MultiLineStringLiteral } from "#geometries/line-string";
|
|
9
|
+
import type { MultiPointLiteral, PointLiteral } from "#geometries/point";
|
|
10
|
+
import type { MultiPolygonLiteral, PolygonLiteral } from "#geometries/polygon";
|
|
11
|
+
import type { GeoObjectLiteral } from "#objects";
|
|
12
12
|
/**
|
|
13
13
|
* Union of the GeoJSON geometry types.
|
|
14
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../geometries/collection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../lib/geometries/collection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AACxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEhD;;GAEG;AACH,MAAM,MAAM,eAAe,GACxB,YAAY,GACZ,iBAAiB,GACjB,iBAAiB,GACjB,sBAAsB,GACtB,cAAc,GACd,mBAAmB,CAAA;AAEtB;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC3D;;OAEG;IACH,IAAI,EAAE,oBAAoB,CAAA;IAC1B;;OAEG;IACH,UAAU,EAAE,eAAe,EAAE,CAAA;CAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../geometries/collection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
1
|
+
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../lib/geometries/collection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* GeoJSON Geometry Entry Point
|
|
7
7
|
*/
|
|
8
|
-
export * from "
|
|
9
|
-
export * from "
|
|
10
|
-
export * from "
|
|
11
|
-
export * from "
|
|
8
|
+
export * from "#geometries/collection";
|
|
9
|
+
export * from "#geometries/line-string";
|
|
10
|
+
export * from "#geometries/point";
|
|
11
|
+
export * from "#geometries/polygon";
|
|
12
|
+
export * from "#geometries/ring-blob";
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../geometries/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/geometries/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA"}
|
package/out/geometries/index.js
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* GeoJSON Geometry Entry Point
|
|
7
7
|
*/
|
|
8
|
-
export * from "
|
|
9
|
-
export * from "
|
|
10
|
-
export * from "
|
|
11
|
-
export * from "
|
|
8
|
+
export * from "#geometries/collection";
|
|
9
|
+
export * from "#geometries/line-string";
|
|
10
|
+
export * from "#geometries/point";
|
|
11
|
+
export * from "#geometries/polygon";
|
|
12
|
+
export * from "#geometries/ring-blob";
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../geometries/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/geometries/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA"}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*
|
|
6
6
|
* GeoJSON Line String
|
|
7
7
|
*/
|
|
8
|
-
import type { GeoObjectLiteral } from "
|
|
9
|
-
import type { Coordinates2D, Coordinates3D } from "
|
|
8
|
+
import type { GeoObjectLiteral } from "#objects";
|
|
9
|
+
import type { Coordinates2D, Coordinates3D } from "#position";
|
|
10
10
|
/**
|
|
11
11
|
* An array of positions forming a line, such as a road or a path.
|
|
12
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-string.d.ts","sourceRoot":"","sources":["../../geometries/line-string.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"line-string.d.ts","sourceRoot":"","sources":["../../lib/geometries/line-string.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAE7D;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC,CAAC,CAAA;AAE9E;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IAC1D;;OAEG;IACH,IAAI,EAAE,YAAY,CAAA;IAClB;;;;OAIG;IACH,WAAW,EAAE,cAAc,CAAA;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC/D;;OAEG;IACH,IAAI,EAAE,iBAAiB,CAAA;IACvB;;;;OAIG;IACH,WAAW,EAAE,cAAc,EAAE,CAAA;CAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-string.js","sourceRoot":"","sources":["../../geometries/line-string.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
1
|
+
{"version":3,"file":"line-string.js","sourceRoot":"","sources":["../../lib/geometries/line-string.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type google from "@googlemaps/google-maps-services-js";
|
|
7
7
|
import type { LatLng, LatLngLiteral } from "@googlemaps/google-maps-services-js";
|
|
8
|
-
import { type BBox2DLiteral, type BBox3DLiteral, GeoBoundingBox } from "
|
|
9
|
-
import { type H3Cell } from "
|
|
10
|
-
import { type GeoObjectLiteral } from "
|
|
11
|
-
import { type InternalPointCoordinates, type Coordinates2D as Point2DCoordinates, type Coordinates3D as Point3DCoordinates } from "
|
|
8
|
+
import { type BBox2DLiteral, type BBox3DLiteral, GeoBoundingBox } from "#bbox";
|
|
9
|
+
import { type H3Cell } from "#h3/cell";
|
|
10
|
+
import { type GeoObjectLiteral } from "#objects";
|
|
11
|
+
import { type InternalPointCoordinates, type Coordinates2D as Point2DCoordinates, type Coordinates3D as Point3DCoordinates } from "#position";
|
|
12
12
|
/**
|
|
13
13
|
* A JSON-serializeable single point geometry, such as a specific location, address, or longitude, latitude pair.
|
|
14
14
|
*
|
|
@@ -82,7 +82,7 @@ export declare class GeoPoint implements PointLiteral {
|
|
|
82
82
|
/**
|
|
83
83
|
* Assigns the pair as GeoJSON [longitude, latitude(, altitude)] — the axis order is the contract, never inferred from
|
|
84
84
|
* the magnitudes — and REJECTS a coordinate that is not on the globe. See {@link GeoPoint.from} for why both halves of
|
|
85
|
-
* that sentence are
|
|
85
|
+
* that sentence are required.
|
|
86
86
|
*
|
|
87
87
|
* @throws {RangeError} When longitude is outside [-180, 180] or latitude is outside [-90, 90].
|
|
88
88
|
*/
|
|
@@ -161,9 +161,9 @@ export declare class GeoPoint implements PointLiteral {
|
|
|
161
161
|
* Dallas and left corrupted in Berlin — behaviour selected by the data, from one code path. This change is a no-op
|
|
162
162
|
* for every WELL-FORMED input: a valid `[longitude, latitude]` pair can never have an out-of-range second element,
|
|
163
163
|
* so the heuristic never fired on one.
|
|
164
|
-
* 2. **An out-of-range magnitude is rejected, not repaired.** `[999, 999]` used to produce a GeoPoint reporting latitude
|
|
165
|
-
*
|
|
166
|
-
*
|
|
164
|
+
* 2. **An out-of-range magnitude is rejected, not repaired.** `[999, 999]` used to produce a GeoPoint reporting latitude 999.
|
|
165
|
+
* It now returns `null` here and throws a `RangeError` from the constructor. Note the deliberate asymmetry with
|
|
166
|
+
* the scalar `longitude` / `latitude` setters, which still wrap and clamp: mutating a point is a pan gesture,
|
|
167
167
|
* where 190° meaning -170° is right; PARSING one is a claim about the world, where an impossible magnitude means
|
|
168
168
|
* the input was malformed and any repair invents a location.
|
|
169
169
|
*
|
|
@@ -200,7 +200,7 @@ export declare class GeoPoint implements PointLiteral {
|
|
|
200
200
|
/**
|
|
201
201
|
* Converts the GeoPoint to a H3 short cell address.
|
|
202
202
|
*/
|
|
203
|
-
toH3ShortCell(resolution?: number): import("
|
|
203
|
+
toH3ShortCell(resolution?: number): import("#h3/cell").H3CellShort;
|
|
204
204
|
toString(): string;
|
|
205
205
|
[Symbol.iterator](): Iterator<number>;
|
|
206
206
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../geometries/point.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,qCAAqC,CAAA;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM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mailwoman/core/
|
|
6
|
+
import { tryParsingJSON } from "@mailwoman/core/json";
|
|
7
7
|
import { convert as convertCoords } from "geo-coordinates-parser";
|
|
8
8
|
import { latLngToCell } from "h3-js";
|
|
9
|
-
import { GeoBoundingBox, isBBox } from "
|
|
10
|
-
import { shortenH3Cell } from "
|
|
11
|
-
import { GeometryType } from "
|
|
12
|
-
import { clampLatitude, isCoordPairLiteral, isGoogleMapsLatLngLiteral, isInterpolatedCoordinates, isValidLatitude, isValidLongitude, wrapLongitude, } from "
|
|
9
|
+
import { GeoBoundingBox, isBBox } from "#bbox";
|
|
10
|
+
import { shortenH3Cell } from "#h3/cell";
|
|
11
|
+
import { GeometryType } from "#objects";
|
|
12
|
+
import { clampLatitude, isCoordPairLiteral, isGoogleMapsLatLngLiteral, isInterpolatedCoordinates, isValidLatitude, isValidLongitude, wrapLongitude, } from "#position";
|
|
13
13
|
/**
|
|
14
14
|
* Type-predicate to determine if the given input is a GeoJSON Point geometry.
|
|
15
15
|
*/
|
|
@@ -77,7 +77,7 @@ export class GeoPoint {
|
|
|
77
77
|
/**
|
|
78
78
|
* Assigns the pair as GeoJSON [longitude, latitude(, altitude)] — the axis order is the contract, never inferred from
|
|
79
79
|
* the magnitudes — and REJECTS a coordinate that is not on the globe. See {@link GeoPoint.from} for why both halves of
|
|
80
|
-
* that sentence are
|
|
80
|
+
* that sentence are required.
|
|
81
81
|
*
|
|
82
82
|
* @throws {RangeError} When longitude is outside [-180, 180] or latitude is outside [-90, 90].
|
|
83
83
|
*/
|
|
@@ -171,9 +171,9 @@ export class GeoPoint {
|
|
|
171
171
|
* Dallas and left corrupted in Berlin — behaviour selected by the data, from one code path. This change is a no-op
|
|
172
172
|
* for every WELL-FORMED input: a valid `[longitude, latitude]` pair can never have an out-of-range second element,
|
|
173
173
|
* so the heuristic never fired on one.
|
|
174
|
-
* 2. **An out-of-range magnitude is rejected, not repaired.** `[999, 999]` used to produce a GeoPoint reporting latitude
|
|
175
|
-
*
|
|
176
|
-
*
|
|
174
|
+
* 2. **An out-of-range magnitude is rejected, not repaired.** `[999, 999]` used to produce a GeoPoint reporting latitude 999.
|
|
175
|
+
* It now returns `null` here and throws a `RangeError` from the constructor. Note the deliberate asymmetry with
|
|
176
|
+
* the scalar `longitude` / `latitude` setters, which still wrap and clamp: mutating a point is a pan gesture,
|
|
177
177
|
* where 190° meaning -170° is right; PARSING one is a claim about the world, where an impossible magnitude means
|
|
178
178
|
* the input was malformed and any repair invents a location.
|
|
179
179
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point.js","sourceRoot":"","sources":["../../geometries/point.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"point.js","sourceRoot":"","sources":["../../lib/geometries/point.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC,OAAO,EAA0C,cAAc,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACtF,OAAO,EAAe,aAAa,EAAE,MAAM,UAAU,CAAA;AACrD,OAAO,EAAyB,YAAY,EAAE,MAAM,UAAU,CAAA;AAC9D,OAAO,EAIN,aAAa,EACb,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,EACzB,eAAe,EACf,gBAAgB,EAChB,aAAa,GACb,MAAM,WAAW,CAAA;AA4BlB;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAAgD;IAC9E,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAErD,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IAEpC,IAAI,CAAC,CAAC,aAAa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AG,EAAE,IAAI,CAAC,UAAU;SACpB,CAAA;IACF,CAAC;IAED;;OAEG;IACI,KAAK;QACX,MAAM,SAAS,GAAG,aAAa,CAAC,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;QAEvE,OAAO,SAAS,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAA;IAC3C,CAAC;IAED;;OAEG;IACI,QAAQ,CAAC,UAAU,GAAG,EAAE;QAC9B,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,CAAW,CAAA;QAEhF,OAAO,IAAI,CAAA;IACZ,CAAC;IAED;;OAEG;IACI,aAAa,CAAC,UAAU,GAAG,EAAE;QACnC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;QAEtC,OAAO,aAAa,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC;IAEM,QAAQ;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;IACrC,CAAC;IACD,YAAY;IAEL,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvB,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;IAC3C,CAAC;CACD"}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
7
|
-
import type { LineStringPath } from "
|
|
6
|
+
import type { GeometryLiteral } from "#geometries/collection";
|
|
7
|
+
import type { LineStringPath } from "#geometries/line-string";
|
|
8
|
+
import type { GeoObjectLiteral } from "#objects";
|
|
8
9
|
/**
|
|
9
10
|
* An array of positions forming a closed shape, such as a country or a lake.
|
|
10
11
|
*
|
|
@@ -83,7 +84,7 @@ export type PolygonPath = SolidPolygonPath | NestedPolygonPath;
|
|
|
83
84
|
/**
|
|
84
85
|
* An array of positions forming a closed shape, such as a country or a lake.
|
|
85
86
|
*/
|
|
86
|
-
export interface PolygonLiteral<P extends PolygonPath =
|
|
87
|
+
export interface PolygonLiteral<P extends PolygonPath = PolygonPath> extends GeoObjectLiteral {
|
|
87
88
|
/**
|
|
88
89
|
* Declares the type of GeoJSON object as a `Polygon` geometry.
|
|
89
90
|
*/
|
|
@@ -104,7 +105,7 @@ export declare function isPolygonLiteral<P extends PolygonPath = PolygonPath>(in
|
|
|
104
105
|
/**
|
|
105
106
|
* Predicate for checking if a polygon geometry is a solid, i.e. it has no holes.
|
|
106
107
|
*/
|
|
107
|
-
export declare function isSolidPolygonPath(input: PolygonLiteral): boolean;
|
|
108
|
+
export declare function isSolidPolygonPath(input: PolygonLiteral<PolygonPath>): boolean;
|
|
108
109
|
/**
|
|
109
110
|
* A linear ring as the containment predicates read it: positions of `[lon, lat, …]`.
|
|
110
111
|
*
|
|
@@ -114,6 +115,16 @@ export declare function isSolidPolygonPath(input: PolygonLiteral): boolean;
|
|
|
114
115
|
* call site and buy nothing the predicate uses.
|
|
115
116
|
*/
|
|
116
117
|
export type ContainmentRing = readonly (readonly number[])[];
|
|
118
|
+
/**
|
|
119
|
+
* One polygon's rings: `[exterior, ...holes]` — a `Polygon`'s `coordinates`, read loosely (see
|
|
120
|
+
* {@linkcode ContainmentRing}).
|
|
121
|
+
*/
|
|
122
|
+
export type PolygonRings = readonly ContainmentRing[];
|
|
123
|
+
/**
|
|
124
|
+
* A feature's polygons — `MultiPolygon` coordinates, with a bare `Polygon` lifted into the same shape by
|
|
125
|
+
* {@linkcode arealPolygons}.
|
|
126
|
+
*/
|
|
127
|
+
export type MultiPolygonRings = readonly PolygonRings[];
|
|
117
128
|
/**
|
|
118
129
|
* Ray-cast a point against ONE linear ring — the even-odd crossing count. Shoot a ray along +lon and toggle on every
|
|
119
130
|
* edge crossing.
|
|
@@ -129,7 +140,7 @@ export declare function pointInRing(lon: number, lat: number, ring: ContainmentR
|
|
|
129
140
|
* without depending on ring winding order. GeoJSON nominally specifies orientation, but the gazetteer sources do not
|
|
130
141
|
* reliably honour it, so the orientation-free rule is the one that survives real data.
|
|
131
142
|
*/
|
|
132
|
-
export declare function pointInPolygon(lon: number, lat: number, rings:
|
|
143
|
+
export declare function pointInPolygon(lon: number, lat: number, rings: PolygonRings): boolean;
|
|
133
144
|
/**
|
|
134
145
|
* Inside ANY polygon of a multi-polygon.
|
|
135
146
|
*/
|
|
@@ -137,7 +148,7 @@ export declare function pointInMultiPolygon(lon: number, lat: number, polygons:
|
|
|
137
148
|
/**
|
|
138
149
|
* A collection of polygons, such as a country with islands or a lake with islands.
|
|
139
150
|
*/
|
|
140
|
-
export interface MultiPolygonLiteral<P extends PolygonPath =
|
|
151
|
+
export interface MultiPolygonLiteral<P extends PolygonPath = PolygonPath> extends GeoObjectLiteral {
|
|
141
152
|
type: "MultiPolygon";
|
|
142
153
|
/**
|
|
143
154
|
* One ring array per polygon — `coordinates[polygon][ring][position]`, matching a `Polygon`'s `coordinates` lifted by
|
|
@@ -148,62 +159,55 @@ export interface MultiPolygonLiteral<P extends PolygonPath = SolidPolygonPath> e
|
|
|
148
159
|
coordinates: P[];
|
|
149
160
|
}
|
|
150
161
|
/**
|
|
151
|
-
*
|
|
162
|
+
* A geometry as it arrives from `JSON.parse`, or a typed literal. Nothing has checked the arity of a position and
|
|
163
|
+
* `type` is whatever the source wrote, so a reader narrows on `type` and casts `coordinates` — {@linkcode arealPolygons}
|
|
164
|
+
* is the one place that happens for the areal types.
|
|
152
165
|
*/
|
|
166
|
+
export type ParsedGeometry = GeometryLiteral | {
|
|
167
|
+
type: string;
|
|
168
|
+
coordinates?: unknown;
|
|
169
|
+
};
|
|
153
170
|
/**
|
|
154
|
-
*
|
|
171
|
+
* A geometry's polygons in the `MultiPolygon` coordinate shape, whichever areal type it arrived as — `null` when the
|
|
172
|
+
* geometry is not areal (a Point or a LineString bounds no area).
|
|
155
173
|
*
|
|
156
|
-
*
|
|
174
|
+
* The one place a `Polygon` is lifted to `[rings]`; a caller that must refuse a non-areal geometry does so on the
|
|
175
|
+
* `null`, with its own message.
|
|
157
176
|
*/
|
|
158
|
-
export declare function
|
|
177
|
+
export declare function arealPolygons(geometry: ParsedGeometry | null | undefined): MultiPolygonRings | null;
|
|
159
178
|
/**
|
|
160
|
-
*
|
|
179
|
+
* The polygons of a geometry that MUST be areal — {@linkcode arealPolygons} with the refusal every polygon ingest was
|
|
180
|
+
* writing for itself.
|
|
161
181
|
*
|
|
162
|
-
* @
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
export
|
|
189
|
-
type: "node";
|
|
190
|
-
id: number;
|
|
191
|
-
lat: number;
|
|
192
|
-
lon: number;
|
|
193
|
-
tags: OSMNodeTagRecord;
|
|
194
|
-
}
|
|
195
|
-
export interface OSMOverpassResponseBody {
|
|
196
|
-
version: string;
|
|
197
|
-
generator: string;
|
|
198
|
-
osm3s: {
|
|
199
|
-
timestamp_osm_base: string;
|
|
200
|
-
copyright: string;
|
|
201
|
-
};
|
|
202
|
-
elements: OSMOverpassElement[];
|
|
203
|
-
}
|
|
182
|
+
* @param subject Names the feature in the refusal, e.g. `feature 41209`.
|
|
183
|
+
* @param context Names the calling ingest, so a build log says which layer stopped.
|
|
184
|
+
* @throws {Error} When the geometry is neither a `Polygon` nor a `MultiPolygon`.
|
|
185
|
+
*/
|
|
186
|
+
export declare function requireArealPolygons(geometry: ParsedGeometry, subject: string, context: string): MultiPolygonRings;
|
|
187
|
+
/**
|
|
188
|
+
* Does an areal GeoJSON geometry contain the point?
|
|
189
|
+
*
|
|
190
|
+
* The three-valued return is the point of the function. `null` means the geometry is NOT AREAL — a Point or a
|
|
191
|
+
* LineString cannot contain anything — and a caller must read that as "no polygon on record", the same as a missing
|
|
192
|
+
* geometry, never as a rejection. Collapsing it to `false` is how a place with a point-only record gets excluded from a
|
|
193
|
+
* containment pass instead of falling through to the approximate path.
|
|
194
|
+
*
|
|
195
|
+
* `scripts/eval/pip-containment.py` grades the same containment truth against its own ray cast and has to be matched BY
|
|
196
|
+
* HAND if this one changes — it is the one copy no import can reach.
|
|
197
|
+
*/
|
|
198
|
+
export declare function geometryContains(geometry: ParsedGeometry | null | undefined, lon: number, lat: number): boolean | null;
|
|
199
|
+
/**
|
|
200
|
+
* An axis-aligned rectangle as a closed ring, in GeoJSON `[lon, lat]` order and counter-clockwise — the exterior
|
|
201
|
+
* winding.
|
|
202
|
+
*
|
|
203
|
+
* SHARED BECAUSE THE WINDING IS A CONVENTION AND A SECOND COPY IS A SECOND PLACE FOR IT TO DRIFT. Three layer builders
|
|
204
|
+
* hand-build rectangles for their fixture rungs, and each pairs this with {@link reversedRing} to make a hole. A copy
|
|
205
|
+
* whose hole is wound the same way as its exterior produces a fixture that passes every structural check and tests
|
|
206
|
+
* nothing about hole handling — which is the exact failure the area cross-check exists to catch in production data.
|
|
207
|
+
*/
|
|
208
|
+
export declare function rectangleRing(minLon: number, minLat: number, maxLon: number, maxLat: number): number[][];
|
|
204
209
|
/**
|
|
205
|
-
*
|
|
210
|
+
* The same rectangle wound the other way — a hole, under the GeoJSON convention.
|
|
206
211
|
*/
|
|
207
|
-
export declare function
|
|
208
|
-
export declare function fetchOSMElementViaOverpassAPI(input: PolygonLiteral): Promise<OSMOverpassElement[]>;
|
|
212
|
+
export declare function reversedRing(minLon: number, minLat: number, maxLon: number, maxLat: number): number[][];
|
|
209
213
|
//# sourceMappingURL=polygon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../geometries/polygon.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../lib/geometries/polygon.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEhD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B;;;OAGG;IACH,YAAY,EAAE,cAAc;CAC5B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC/B;;;OAGG;IACH,YAAY,EAAE,cAAc;IAC5B;;OAEG;IACH,GAAG,aAAa,EAAE,cAAc,EAAE;CAClC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,iBAAiB,CAAA;AAE9D;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,CAAE,SAAQ,gBAAgB;IAC5F;;OAEG;IACH,IAAI,EAAE,SAAS,CAAA;IACf;;;;;;OAMG;IACH,WAAW,EAAE,CAAC,CAAA;CACd;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAAC,CAAC,CAAC,CAIhH;AAED;;GAEG;AAGH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG,OAAO,CAE9E;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,CAAC,SAAS,MAAM,EAAE,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