@mailwoman/spatial 9.2.0 → 9.4.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.
Files changed (160) hide show
  1. package/{bbox.ts → lib/bbox.ts} +4 -4
  2. package/{coordinate-bounds.ts → lib/coordinate-bounds.ts} +11 -0
  3. package/{coordinate-formats.ts → lib/coordinate-formats.ts} +3 -1
  4. package/lib/distance.ts +204 -0
  5. package/{feature.ts → lib/feature.ts} +1 -1
  6. package/{geometries → lib/geometries}/collection.ts +4 -4
  7. package/lib/geometries/index.ts +13 -0
  8. package/{geometries → lib/geometries}/line-string.ts +4 -4
  9. package/{geometries → lib/geometries}/point.ts +14 -13
  10. package/{geometries → lib/geometries}/polygon.ts +82 -158
  11. package/lib/geometries/ring-blob.ts +521 -0
  12. package/{google → lib/google}/index.ts +1 -1
  13. package/{h3 → lib/h3}/cell.ts +83 -1
  14. package/lib/h3/coverage.ts +45 -0
  15. package/{h3 → lib/h3}/index.ts +5 -3
  16. package/lib/h3/interior-cells.ts +138 -0
  17. package/lib/h3/polygon-cells.ts +462 -0
  18. package/lib/index.ts +21 -0
  19. package/{objects.ts → lib/objects.ts} +1 -1
  20. package/{open-location-code.ts → lib/open-location-code.ts} +1 -1
  21. package/{osgb36.ts → lib/osgb36.ts} +2 -2
  22. package/{polyline.ts → lib/polyline.ts} +5 -5
  23. package/{position.ts → lib/position.ts} +2 -2
  24. package/lib/projection-transform.ts +115 -0
  25. package/{regions → lib/regions}/codes.ts +1 -1
  26. package/{regions → lib/regions}/index.ts +2 -2
  27. package/lib/tools/ogr-stream.ts +99 -0
  28. package/lib/tools/ogr.ts +201 -0
  29. package/out/bbox.d.ts +2 -2
  30. package/out/bbox.d.ts.map +1 -1
  31. package/out/bbox.js +3 -3
  32. package/out/bbox.js.map +1 -1
  33. package/out/coordinate-bounds.d.ts +9 -0
  34. package/out/coordinate-bounds.d.ts.map +1 -1
  35. package/out/coordinate-bounds.js +9 -0
  36. package/out/coordinate-bounds.js.map +1 -1
  37. package/out/coordinate-formats.d.ts.map +1 -1
  38. package/out/coordinate-formats.js +2 -1
  39. package/out/coordinate-formats.js.map +1 -1
  40. package/out/distance.d.ts +64 -1
  41. package/out/distance.d.ts.map +1 -1
  42. package/out/distance.js +85 -1
  43. package/out/distance.js.map +1 -1
  44. package/out/feature.d.ts +1 -1
  45. package/out/feature.d.ts.map +1 -1
  46. package/out/feature.js.map +1 -1
  47. package/out/geometries/collection.d.ts +4 -4
  48. package/out/geometries/collection.d.ts.map +1 -1
  49. package/out/geometries/collection.js.map +1 -1
  50. package/out/geometries/index.d.ts +5 -4
  51. package/out/geometries/index.d.ts.map +1 -1
  52. package/out/geometries/index.js +5 -4
  53. package/out/geometries/index.js.map +1 -1
  54. package/out/geometries/line-string.d.ts +4 -4
  55. package/out/geometries/line-string.d.ts.map +1 -1
  56. package/out/geometries/line-string.js.map +1 -1
  57. package/out/geometries/point.d.ts +14 -13
  58. package/out/geometries/point.d.ts.map +1 -1
  59. package/out/geometries/point.js +11 -10
  60. package/out/geometries/point.js.map +1 -1
  61. package/out/geometries/polygon.d.ts +51 -100
  62. package/out/geometries/polygon.d.ts.map +1 -1
  63. package/out/geometries/polygon.js +60 -90
  64. package/out/geometries/polygon.js.map +1 -1
  65. package/out/geometries/ring-blob.d.ts +183 -0
  66. package/out/geometries/ring-blob.d.ts.map +1 -0
  67. package/out/geometries/ring-blob.js +376 -0
  68. package/out/geometries/ring-blob.js.map +1 -0
  69. package/out/google/index.d.ts +1 -1
  70. package/out/google/index.d.ts.map +1 -1
  71. package/out/google/index.js +1 -1
  72. package/out/google/index.js.map +1 -1
  73. package/out/google/place-id.d.ts.map +1 -1
  74. package/out/google/place-id.js.map +1 -1
  75. package/out/h3/cell.d.ts +32 -0
  76. package/out/h3/cell.d.ts.map +1 -1
  77. package/out/h3/cell.js +68 -1
  78. package/out/h3/cell.js.map +1 -1
  79. package/out/h3/coverage.d.ts +32 -0
  80. package/out/h3/coverage.d.ts.map +1 -0
  81. package/out/h3/coverage.js +27 -0
  82. package/out/h3/coverage.js.map +1 -0
  83. package/out/h3/index.d.ts +5 -3
  84. package/out/h3/index.d.ts.map +1 -1
  85. package/out/h3/index.js +5 -3
  86. package/out/h3/index.js.map +1 -1
  87. package/out/h3/interior-cells.d.ts +54 -0
  88. package/out/h3/interior-cells.d.ts.map +1 -0
  89. package/out/h3/interior-cells.js +111 -0
  90. package/out/h3/interior-cells.js.map +1 -0
  91. package/out/h3/polygon-cells.d.ts +182 -0
  92. package/out/h3/polygon-cells.d.ts.map +1 -0
  93. package/out/h3/polygon-cells.js +339 -0
  94. package/out/h3/polygon-cells.js.map +1 -0
  95. package/out/index.d.ts +15 -15
  96. package/out/index.d.ts.map +1 -1
  97. package/out/index.js +15 -15
  98. package/out/index.js.map +1 -1
  99. package/out/objects.d.ts +1 -1
  100. package/out/objects.d.ts.map +1 -1
  101. package/out/objects.js +1 -1
  102. package/out/objects.js.map +1 -1
  103. package/out/open-location-code.d.ts.map +1 -1
  104. package/out/open-location-code.js +1 -1
  105. package/out/open-location-code.js.map +1 -1
  106. package/out/osgb36.d.ts +2 -2
  107. package/out/osgb36.d.ts.map +1 -1
  108. package/out/osgb36.js +1 -1
  109. package/out/osgb36.js.map +1 -1
  110. package/out/polyline.d.ts +4 -4
  111. package/out/polyline.d.ts.map +1 -1
  112. package/out/polyline.js +5 -5
  113. package/out/polyline.js.map +1 -1
  114. package/out/position.d.ts +1 -1
  115. package/out/position.d.ts.map +1 -1
  116. package/out/position.js +2 -2
  117. package/out/position.js.map +1 -1
  118. package/out/projection-transform.d.ts +67 -0
  119. package/out/projection-transform.d.ts.map +1 -0
  120. package/out/projection-transform.js +48 -0
  121. package/out/projection-transform.js.map +1 -0
  122. package/out/projection.d.ts.map +1 -1
  123. package/out/projection.js.map +1 -1
  124. package/out/regions/codes.d.ts.map +1 -1
  125. package/out/regions/codes.js.map +1 -1
  126. package/out/regions/index.d.ts +2 -2
  127. package/out/regions/index.d.ts.map +1 -1
  128. package/out/regions/index.js +2 -2
  129. package/out/regions/index.js.map +1 -1
  130. package/out/regions/names.d.ts.map +1 -1
  131. package/out/regions/names.js.map +1 -1
  132. package/out/tools/ogr-stream.d.ts +34 -0
  133. package/out/tools/ogr-stream.d.ts.map +1 -0
  134. package/out/tools/ogr-stream.js +74 -0
  135. package/out/tools/ogr-stream.js.map +1 -0
  136. package/out/tools/ogr.d.ts +87 -0
  137. package/out/tools/ogr.d.ts.map +1 -0
  138. package/out/tools/ogr.js +84 -0
  139. package/out/tools/ogr.js.map +1 -0
  140. package/out/tsconfig.test.tsbuildinfo +1 -1
  141. package/out/well-known-text.d.ts.map +1 -0
  142. package/out/well-known-text.js.map +1 -0
  143. package/package.json +94 -25
  144. package/distance.ts +0 -84
  145. package/geometries/index.ts +0 -12
  146. package/index.ts +0 -21
  147. package/out/sdk/index.d.ts +0 -7
  148. package/out/sdk/index.d.ts.map +0 -1
  149. package/out/sdk/index.js +0 -7
  150. package/out/sdk/index.js.map +0 -1
  151. package/out/sdk/well-known-text.d.ts.map +0 -1
  152. package/out/sdk/well-known-text.js.map +0 -1
  153. package/out/tsconfig.tsbuildinfo +0 -1
  154. package/sdk/index.ts +0 -7
  155. /package/{google → lib/google}/place-id.ts +0 -0
  156. /package/{projection.ts → lib/projection.ts} +0 -0
  157. /package/{regions → lib/regions}/names.ts +0 -0
  158. /package/{sdk → lib}/well-known-text.ts +0 -0
  159. /package/out/{sdk/well-known-text.d.ts → well-known-text.d.ts} +0 -0
  160. /package/out/{sdk/well-known-text.js → well-known-text.js} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage.js","sourceRoot":"","sources":["../../lib/h3/coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAuC,MAAM,wBAAwB,CAAA;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC,OAAO,EAAE,cAAc,EAAe,MAAM,UAAU,CAAA;AAStD;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC7B,MAAwB,EACxB,SAAiB,EACjB,kBAA0B;IAE1B,MAAM,YAAY,GAAG,YAAY,CAAC,SAAS,EAAE,kBAAkB,CAAW,CAAA;IAE1E,OAAO,cAAc,CACpB,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,YAAY,CAAC,CAA4B,EACnE,YAAY,EACZ,kBAAkB,CAClB,CAAA;AACF,CAAC"}
package/out/h3/index.d.ts CHANGED
@@ -3,9 +3,11 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  */
6
- import { GeoPoint, type PointLiteral } from "../geometries/point.ts";
7
- import { type H3Cell, type H3CellShort } from "./cell.ts";
8
- export * from "./cell.ts";
6
+ import { GeoPoint, type PointLiteral } from "#geometries/point";
7
+ import { type H3Cell, type H3CellShort } from "#h3/cell";
8
+ export * from "#h3/cell";
9
+ export * from "#h3/interior-cells";
10
+ export * from "#h3/polygon-cells";
9
11
  /**
10
12
  * Given a short cell address and the resolution it was captured at, return the centre of that cell.
11
13
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../h3/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACpE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW,EAAgB,MAAM,WAAW,CAAA;AAEvE,cAAc,WAAW,CAAA;AAEzB;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,WAAW,EAAE,UAAU,SAAK,GAAG,QAAQ,CAOlF;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAO7D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/h3/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW,EAAgB,MAAM,UAAU,CAAA;AAEtE,cAAc,UAAU,CAAA;AACxB,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AAEjC;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,WAAW,EAAE,UAAU,SAAK,GAAG,QAAQ,CAOlF;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAO7D"}
package/out/h3/index.js CHANGED
@@ -4,9 +4,11 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  */
6
6
  import { cellToLatLng } from "h3-js";
7
- import { GeoPoint } from "../geometries/point.js";
8
- import { expandH3Cell } from "./cell.js";
9
- export * from "./cell.js";
7
+ import { GeoPoint } from "#geometries/point";
8
+ import { expandH3Cell } from "#h3/cell";
9
+ export * from "#h3/cell";
10
+ export * from "#h3/interior-cells";
11
+ export * from "#h3/polygon-cells";
10
12
  /**
11
13
  * Given a short cell address and the resolution it was captured at, return the centre of that cell.
12
14
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../h3/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC,OAAO,EAAE,QAAQ,EAAqB,MAAM,wBAAwB,CAAA;AACpE,OAAO,EAAiC,YAAY,EAAE,MAAM,WAAW,CAAA;AAEvE,cAAc,WAAW,CAAA;AAEzB;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAsB,EAAE,UAAU,GAAG,EAAE;IACvE,MAAM,IAAI,GAAG,YAAY,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;IAEhD,2DAA2D;IAC3D,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;IAEhD,OAA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GPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Turn an outline into the H3 cell set a coverage claim may be keyed to.
7
+ *
8
+ * Polyfilling a rectangle is right for a rectangular extract and wrong for a region: a region is
9
+ * clipped to a polygon, so a rectangle polyfilled over it claims survey across whatever the rectangle
10
+ * overhangs. These helpers answer the narrower question — which cells lie wholly INSIDE the outline —
11
+ * and they answer conservatively, because the cells they return are the ones a completeness claim will
12
+ * be written to.
13
+ *
14
+ * Interior is two tests, both required. A cell must have its whole `gridDisk(cell, 1)` inside the
15
+ * outline's own polyfill, and all six of its boundary vertices inside the polygon. The first removes the
16
+ * polyfill's edge ring (H3's polyfill keeps a cell whose CENTRE is inside, so an edge cell can be half
17
+ * outside); the second catches a boundary that re-enters between two neighbours. Neither test alone is
18
+ * sufficient, and the cost of being wrong is asymmetric — a cell wrongly called interior claims a survey
19
+ * over ground the source never covered.
20
+ *
21
+ * Measured on the Île-de-France région (OSM relation 8649, admin_level 4) at res 6: 371 polyfilled
22
+ * cells, 290 interior, holding 3,248 of the extract's 3,308 `amenity=pharmacy` features.
23
+ */
24
+ import { type ParsedGeometry } from "#geometries/polygon";
25
+ import { type H3Cell } from "#h3/cell";
26
+ /**
27
+ * The outline's bounding rectangle, for pre-clipping a reference inventory that can only be probed by range.
28
+ *
29
+ * A coarse filter and nothing more — it CONTAINS the outline and is never the outline. The exact clip is
30
+ * {@link interiorCoverageCellSet}; using this rectangle as the region would claim survey over every corner the outline
31
+ * does not reach.
32
+ */
33
+ export declare function geometryBBox(geometry: ParsedGeometry): {
34
+ minLon: number;
35
+ minLat: number;
36
+ maxLon: number;
37
+ maxLat: number;
38
+ };
39
+ /**
40
+ * Every cell whose CENTRE falls inside `geometry`, at `resolution`. The raw polyfill — {@link interiorCoverageCells}
41
+ * narrows it.
42
+ */
43
+ export declare function regionCoverageCells(geometry: ParsedGeometry, resolution: number): H3Cell[];
44
+ /**
45
+ * The cells of {@link regionCoverageCells} that lie wholly inside `geometry` — see the module docstring for why both
46
+ * tests are applied.
47
+ */
48
+ export declare function interiorCoverageCells(geometry: ParsedGeometry, resolution: number): H3Cell[];
49
+ /**
50
+ * The 48-bit short-cell form of {@link interiorCoverageCells}, as a membership set — the shape both a row clipper and a
51
+ * coverage writer probe.
52
+ */
53
+ export declare function interiorCoverageCellSet(geometry: ParsedGeometry, resolution: number): Set<number>;
54
+ //# sourceMappingURL=interior-cells.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interior-cells.d.ts","sourceRoot":"","sources":["../../lib/h3/interior-cells.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,EAAmC,KAAK,cAAc,EAAqB,MAAM,qBAAqB,CAAA;AAC7G,OAAO,EAAkB,KAAK,MAAM,EAAE,MAAM,UAAU,CAAA;AAmBtD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,cAAc,GAAG;IACvD,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACd,CA+BA;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAa1F;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAe5F;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAEjG"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * @copyright Sister Software.
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Turn an outline into the H3 cell set a coverage claim may be keyed to.
7
+ *
8
+ * Polyfilling a rectangle is right for a rectangular extract and wrong for a region: a region is
9
+ * clipped to a polygon, so a rectangle polyfilled over it claims survey across whatever the rectangle
10
+ * overhangs. These helpers answer the narrower question — which cells lie wholly INSIDE the outline —
11
+ * and they answer conservatively, because the cells they return are the ones a completeness claim will
12
+ * be written to.
13
+ *
14
+ * Interior is two tests, both required. A cell must have its whole `gridDisk(cell, 1)` inside the
15
+ * outline's own polyfill, and all six of its boundary vertices inside the polygon. The first removes the
16
+ * polyfill's edge ring (H3's polyfill keeps a cell whose CENTRE is inside, so an edge cell can be half
17
+ * outside); the second catches a boundary that re-enters between two neighbours. Neither test alone is
18
+ * sufficient, and the cost of being wrong is asymmetric — a cell wrongly called interior claims a survey
19
+ * over ground the source never covered.
20
+ *
21
+ * Measured on the Île-de-France région (OSM relation 8649, admin_level 4) at res 6: 371 polyfilled
22
+ * cells, 290 interior, holding 3,248 of the extract's 3,308 `amenity=pharmacy` features.
23
+ */
24
+ import { cellToBoundary, gridDisk, polygonToCells } from "h3-js";
25
+ import { arealPolygons, geometryContains } from "#geometries/polygon";
26
+ import { shortCellToInt } from "#h3/cell";
27
+ /**
28
+ * The rings a polyfill walks: every polygon's OUTER ring. Holes are deliberately not subtracted here — a hole would
29
+ * only ever remove cells, and the interior test below re-checks every returned cell's vertices against the full
30
+ * geometry (holes included), so a hole cannot survive into the result.
31
+ */
32
+ function outerRings(geometry) {
33
+ const polygons = arealPolygons(geometry);
34
+ if (!polygons) {
35
+ throw new Error(`coverage region: expected a Polygon or MultiPolygon geometry, got ${JSON.stringify(geometry.type)}`);
36
+ }
37
+ return polygons.filter((rings) => rings.length).map((rings) => rings[0]);
38
+ }
39
+ /**
40
+ * The outline's bounding rectangle, for pre-clipping a reference inventory that can only be probed by range.
41
+ *
42
+ * A coarse filter and nothing more — it CONTAINS the outline and is never the outline. The exact clip is
43
+ * {@link interiorCoverageCellSet}; using this rectangle as the region would claim survey over every corner the outline
44
+ * does not reach.
45
+ */
46
+ export function geometryBBox(geometry) {
47
+ let minLon = Infinity;
48
+ let minLat = Infinity;
49
+ let maxLon = -Infinity;
50
+ let maxLat = -Infinity;
51
+ for (const ring of outerRings(geometry)) {
52
+ for (const [lon, lat] of ring) {
53
+ if (lon < minLon) {
54
+ minLon = lon;
55
+ }
56
+ if (lon > maxLon) {
57
+ maxLon = lon;
58
+ }
59
+ if (lat < minLat) {
60
+ minLat = lat;
61
+ }
62
+ if (lat > maxLat) {
63
+ maxLat = lat;
64
+ }
65
+ }
66
+ }
67
+ if (!Number.isFinite(minLon) || !Number.isFinite(minLat)) {
68
+ throw new TypeError("coverage region: geometry carries no coordinates to bound");
69
+ }
70
+ return { minLon, minLat, maxLon, maxLat };
71
+ }
72
+ /**
73
+ * Every cell whose CENTRE falls inside `geometry`, at `resolution`. The raw polyfill — {@link interiorCoverageCells}
74
+ * narrows it.
75
+ */
76
+ export function regionCoverageCells(geometry, resolution) {
77
+ const cells = new Set();
78
+ for (const ring of outerRings(geometry)) {
79
+ // polygonToCells's default (non-GeoJSON) coordinate order is [lat, lng] per vertex.
80
+ const latLng = ring.map(([lon, lat]) => [lat, lon]);
81
+ for (const cell of polygonToCells(latLng, resolution)) {
82
+ cells.add(cell);
83
+ }
84
+ }
85
+ return [...cells];
86
+ }
87
+ /**
88
+ * The cells of {@link regionCoverageCells} that lie wholly inside `geometry` — see the module docstring for why both
89
+ * tests are applied.
90
+ */
91
+ export function interiorCoverageCells(geometry, resolution) {
92
+ const polyfilled = new Set(regionCoverageCells(geometry, resolution));
93
+ const interior = [];
94
+ for (const cell of polyfilled) {
95
+ if (!gridDisk(cell, 1).every((neighbor) => polyfilled.has(neighbor)))
96
+ continue;
97
+ const vertices = cellToBoundary(cell);
98
+ if (!vertices.every(([lat, lon]) => geometryContains(geometry, lon, lat)))
99
+ continue;
100
+ interior.push(cell);
101
+ }
102
+ return interior;
103
+ }
104
+ /**
105
+ * The 48-bit short-cell form of {@link interiorCoverageCells}, as a membership set — the shape both a row clipper and a
106
+ * coverage writer probe.
107
+ */
108
+ export function interiorCoverageCellSet(geometry, resolution) {
109
+ return new Set(interiorCoverageCells(geometry, resolution).map((cell) => shortCellToInt(cell)));
110
+ }
111
+ //# sourceMappingURL=interior-cells.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interior-cells.js","sourceRoot":"","sources":["../../lib/h3/interior-cells.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAEhE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAA0C,MAAM,qBAAqB,CAAA;AAC7G,OAAO,EAAE,cAAc,EAAe,MAAM,UAAU,CAAA;AAEtD;;;;GAIG;AACH,SAAS,UAAU,CAAC,QAAwB;IAC3C,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;IAExC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACd,qEAAqE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CACpG,CAAA;IACF,CAAC;IAED,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAA;AAC1E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,QAAwB;IAMpD,IAAI,MAAM,GAAG,QAAQ,CAAA;IACrB,IAAI,MAAM,GAAG,QAAQ,CAAA;IACrB,IAAI,MAAM,GAAG,CAAC,QAAQ,CAAA;IACtB,IAAI,MAAM,GAAG,CAAC,QAAQ,CAAA;IAEtB,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzC,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,CAA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IACjF,MAAM,UAAU,GAAG,IAAI,GAAG,CAAS,mBAAmB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAA;IAC7E,MAAM,QAAQ,GAAa,EAAE,CAAA;IAE7B,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAAE,SAAQ;QAE9E,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAe,CAAA;QAEnD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAI,EAAE,GAAI,CAAC,CAAC;YAAE,SAAQ;QAErF,QAAQ,CAAC,IAAI,CAAC,IAAc,CAAC,CAAA;IAC9B,CAAC;IAED,OAAO,QAAQ,CAAA;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAwB,EAAE,UAAkB;IACnF,OAAO,IAAI,GAAG,CAAC,qBAAqB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAChG,CAAC"}
@@ -0,0 +1,182 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Turn one authority polygon into the H3 cells that summarize it — the conversion SCOPE invariant 6 asks
7
+ * for, done once at build time so the runtime probes structure instead of geometry.
8
+ *
9
+ * SHARED BY EVERY POLYGON LAYER RATHER THAN COPIED INTO EACH, because the traps below are properties of
10
+ * the TOOL rather than of any one product. `packages/flood` measured them; `packages/soil` inherits them
11
+ * unchanged; the layer contract's polygon-builder section states them as requirements. A second copy of
12
+ * an allocator guard is a second place for it to stop guarding.
13
+ *
14
+ * THE INDEX IS CELL-TOUCHES-POLYGON, NOT CENTRE-IN-POLYGON, AND A ZERO-CELL FEATURE FAILS THE BUILD.
15
+ * A polyfill keyed on cell centres drops every polygon smaller than a cell, and each dropped feature
16
+ * reads downstream as an absence. Measured: on Ireland's zoning layer `polygonToCells` returns zero cells
17
+ * for 86.8% of polygons at resolution 9, and the EA flood product's first row is a 128 m² square that
18
+ * `polygonToCells` misses at resolutions 7 through 10 while `containmentOverlapping` returns one cell for
19
+ * it. So the index takes overlapping containment, and {@link classifyFeatureCells} throws on a feature
20
+ * that reaches no cell rather than skipping it.
21
+ *
22
+ * THE `[lat, lng]` TRAP IS AVOIDED BY NOT ENTERING IT. h3-js reads a vertex as `[lat, lng]` in its
23
+ * default mode; every call here passes `isGeoJSON = true` and hands it GeoJSON-order `[lon, lat]` rings,
24
+ * which is the order an ingest already produces. Converting instead would put a transposition between the
25
+ * geometry and the index that nothing downstream could see.
26
+ *
27
+ * WHOLE AND PARTIAL ARE TWO POLYFILLS OF THE SAME RING, NOT A TEST WE INVENT. `containmentFull` is the
28
+ * cell set entirely inside the polygon; `containmentOverlapping` is the set that touches it at all. The
29
+ * difference is exactly the boundary fringe, which is where the geometry tier has to be consulted.
30
+ *
31
+ * MOST PARTS NEVER REACH h3 AT ALL, AND THAT IS THE POINT. The WASM heap is exhausted by CALL VOLUME, not
32
+ * by any one polygon: h3-js frees every buffer it allocates, so what accumulates over millions of
33
+ * interleaved tiny and large allocations is fragmentation. Three runs over the EA product died on the
34
+ * same feature after roughly 510,000 others — a 164 m² feature of 23 parts and 130 vertices that
35
+ * classifies in 35 ms at every resolution 9 through 4 in a fresh process. So the calls are removed rather
36
+ * than shrunk, in the two places where the answer is a fact about geometry: {@link enclosingCell} (a part
37
+ * whose bounding-box corners all fall in one cell lies inside it, because a cell is convex) and
38
+ * {@link canContainCell} (a part narrower than `edge × √3` cannot enclose a hexagon, so its
39
+ * `containmentFull` set is empty). Both were checked against the unconditional polyfill over 60,000 real
40
+ * features at resolution 9 with zero disagreements, and `packages/flood/test/unit/cells.test.ts` pins the
41
+ * comparison.
42
+ *
43
+ * A BIG POLYGON IS ALSO INDEXED COARSER, BECAUSE h3's ALLOCATOR IS SIZED FROM THE BOUNDING BOX.
44
+ * `polygonToCells` reserves room for the whole bounding box before it walks anything, so a long thin river
45
+ * polygon reserves the rectangle the river's meanders span rather than the river. Each feature is
46
+ * therefore indexed at the finest resolution whose bounding-box estimate fits {@link CELL_ESTIMATE_BUDGET},
47
+ * and the resolution it got is returned on the result. That is not a compromise bolted on: a coarse cell
48
+ * wholly inside a large polygon is exactly what `compactCells` would have produced anyway, so the whole
49
+ * tier is unchanged in meaning and only the fringe is coarser.
50
+ *
51
+ * AND THE ESTIMATE IS A PREDICTION, SO AN ALLOCATION FAILURE IS RECOVERED RATHER THAN FATAL.
52
+ * {@linkcode classifyFeatureCells} steps the resolution down and retries; only a feature that fails at
53
+ * {@linkcode MIN_INDEX_RESOLUTION} is refused. Nothing is ever skipped, because a skipped feature is an
54
+ * invented absence.
55
+ *
56
+ * BOUNDING THE CALL VOLUME IS THE CALLER'S JOB AND IT IS NOT OPTIONAL. The shortcuts here make a build
57
+ * faster; they are not what makes it reproducible. A builder runs the classification in child processes
58
+ * over ranges of the source's own stable ids, so each gets a heap that starts empty — see
59
+ * `packages/flood/lib/sdk/ingest-chunk.ts` and `packages/soil/lib/sdk/ingest-chunk.ts`.
60
+ */
61
+ import type { MultiPolygonRings } from "#geometries/polygon";
62
+ import { type H3Cell } from "#h3/cell";
63
+ /**
64
+ * The largest bounding-box cell estimate a single polyfill may reserve.
65
+ *
66
+ * H3-js allocates its output buffer from the polygon's bounding box before walking, so this is a memory ceiling rather
67
+ * than a limit on real output: two million cells is sixteen megabytes of `uint64`, comfortably inside the WASM heap,
68
+ * and the largest EA flood features exceed it by orders of magnitude at resolution 9 (the run that established this
69
+ * failed with `Memory allocation failed (code: 13)`).
70
+ */
71
+ export declare const CELL_ESTIMATE_BUDGET = 2000000;
72
+ /**
73
+ * The coarsest resolution a feature may be pushed down to. Below this a "cell" is tens of thousands of square
74
+ * kilometres and the index stops summarizing anything.
75
+ */
76
+ export declare const MIN_INDEX_RESOLUTION = 4;
77
+ /**
78
+ * A rectangle in degrees, the shape every helper here prefilters on.
79
+ */
80
+ export interface DegreeBox {
81
+ minLat: number;
82
+ minLon: number;
83
+ maxLat: number;
84
+ maxLon: number;
85
+ }
86
+ /**
87
+ * The two cell sets one feature produces, and the resolution they came out at.
88
+ */
89
+ export interface FeatureCells {
90
+ /**
91
+ * The resolution this feature was indexed at — the target, or coarser where the target's estimate did not fit.
92
+ */
93
+ resolution: number;
94
+ /**
95
+ * Cells lying entirely inside the feature. A point in one of these is inside without a geometry read.
96
+ */
97
+ whole: H3Cell[];
98
+ /**
99
+ * Cells the feature reaches but does not fill. A point in one of these needs the ray cast.
100
+ */
101
+ partial: H3Cell[];
102
+ }
103
+ /**
104
+ * How many cells at `resolution` the feature's bounding box spans.
105
+ *
106
+ * The same quantity h3 reserves its buffer from, computed here so an oversized polyfill is never issued. Approximate on
107
+ * purpose: it decides which resolution to ask for, not what the answer is.
108
+ */
109
+ export declare function estimateCellCount(polygons: MultiPolygonRings, resolution: number): number;
110
+ /**
111
+ * The finest resolution at or below `target` whose estimate fits the budget.
112
+ */
113
+ export declare function resolutionForFeature(polygons: MultiPolygonRings, target: number): number;
114
+ /**
115
+ * Classify one feature's cells, at `targetResolution` or the coarsest resolution its bounding box allows.
116
+ *
117
+ * @param layerLabel Names the layer in every message, so a build log says which artifact refused rather than only which
118
+ * feature.
119
+ * @throws {Error} When the feature reaches no cell at all. That cannot happen with overlapping containment on a valid
120
+ * ring, so it means the geometry is degenerate — and a silently skipped feature is an invented absence.
121
+ */
122
+ export declare function classifyFeatureCells(polygons: MultiPolygonRings, targetResolution: number, featureID: string, layerLabel?: string): FeatureCells;
123
+ /**
124
+ * Split a cell set into same-resolution groups — what `compactCells` requires, and what an adaptively-indexed layer
125
+ * cannot assume it already has.
126
+ *
127
+ * Pooling mixed resolutions throws inside h3; compacting only the target-resolution group would silently drop every
128
+ * coarsened feature's interior, which is the shape of failure that still produces an artifact.
129
+ */
130
+ export declare function groupCellsByResolution(cells: Iterable<string>): string[][];
131
+ /**
132
+ * Compact a cell set that may span several resolutions.
133
+ *
134
+ * `compactCells` takes one resolution at a time, and an adaptively-indexed layer's coarsened features sit at another —
135
+ * so the set is grouped before compaction rather than pooled. Pooling would throw; compacting only the
136
+ * target-resolution group would silently drop every coarsened feature's interior, which is the shape of failure that
137
+ * still produces an artifact.
138
+ */
139
+ export declare function compactAcrossResolutions(cells: Iterable<string>): string[];
140
+ /**
141
+ * The cells a probe walks for one index cell: the cell itself at the index resolution, and its parent at every other
142
+ * resolution the layer stores.
143
+ *
144
+ * The stored rows sit at SEVERAL resolutions — each feature's whole tier is compacted parent-ward, and a polygon too
145
+ * large for h3's allocator at the index resolution was indexed coarser — so a point is answered by walking its own
146
+ * ancestor chain over every resolution the layer stores.
147
+ */
148
+ export declare function ancestorChainCells(indexCell: H3Cell, indexResolution: number, resolutions: readonly number[]): H3Cell[];
149
+ /**
150
+ * One classified feature's cell rows, ready for insertion — the whole set compacted, the partial set left at its own
151
+ * resolution.
152
+ *
153
+ * SHARED BY EVERY POLYGON LAYER WHOSE CELL ROW NAMES A POLYGON rather than a class accumulated across features. There
154
+ * is no product knowledge in it: compaction, the short-cell encoding and the belt-and-braces subtraction below are h3
155
+ * and blob arithmetic, and a second copy is a second place for the subtraction to stop happening.
156
+ *
157
+ * COMPACTION IS PER FEATURE, which is what keeps a build's memory flat in row count with no temporary table: a row that
158
+ * names one polygon is final the moment that polygon is classified. Only the WHOLE set is compacted — compacting the
159
+ * fringe would claim it covers ground it does not.
160
+ */
161
+ export declare function featureCellRows(cells: FeatureCells): Array<{
162
+ h3Cell: number;
163
+ resolution: number;
164
+ containment: "whole" | "partial";
165
+ }>;
166
+ /**
167
+ * The coverage cell a row at `cell` belongs to.
168
+ *
169
+ * `cellToParent` of the finer cell, never a fresh `latLngToCell` at the coarse resolution: every existing reader in
170
+ * this repo derives a coverage cell that way, and the two agree for a point but not for a cell — a re-derivation from a
171
+ * representative point would put a fringe row in a neighbouring coverage cell.
172
+ */
173
+ export declare function coverageCellFor(cell: H3Cell, coverageResolution: number): H3Cell;
174
+ /**
175
+ * Record the coverage cells one index cell falls in.
176
+ *
177
+ * An adaptively-coarsened cell can be COARSER than the coverage resolution, in which case it spans several coverage
178
+ * cells and every one of them is recorded: a coarse cell counted against one arbitrary child would leave the others
179
+ * reading as empty.
180
+ */
181
+ export declare function addCoverageCells(into: Set<number>, cell: H3Cell, cellResolution: number, coverageResolution: number): void;
182
+ //# sourceMappingURL=polygon-cells.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polygon-cells.d.ts","sourceRoot":"","sources":["../../lib/h3/polygon-cells.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AAeH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE5D,OAAO,EAAkB,KAAK,MAAM,EAAE,MAAM,UAAU,CAAA;AAEtD;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,UAAY,CAAA;AAE7C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAA;AAErC;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACd;AAuDD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAA;IACf;;OAEG;IACH,OAAO,EAAE,MAAM,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