@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.
Files changed (161) hide show
  1. package/{bbox.ts → lib/bbox.ts} +54 -3
  2. package/lib/coordinate-bounds.ts +52 -0
  3. package/{coordinate-formats.ts → lib/coordinate-formats.ts} +16 -3
  4. package/lib/distance.ts +165 -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 +2 -2
  9. package/{geometries → lib/geometries}/point.ts +9 -9
  10. package/{geometries → lib/geometries}/polygon.ts +93 -89
  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/lib/open-location-code.ts +168 -0
  21. package/{osgb36.ts → lib/osgb36.ts} +2 -2
  22. package/{polyline.ts → lib/polyline.ts} +1 -1
  23. package/lib/position.ts +216 -0
  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/{sdk → lib}/well-known-text.ts +2 -1
  30. package/out/bbox.d.ts +23 -2
  31. package/out/bbox.d.ts.map +1 -1
  32. package/out/bbox.js +33 -2
  33. package/out/bbox.js.map +1 -1
  34. package/out/coordinate-bounds.d.ts +41 -0
  35. package/out/coordinate-bounds.d.ts.map +1 -0
  36. package/out/coordinate-bounds.js +45 -0
  37. package/out/coordinate-bounds.js.map +1 -0
  38. package/out/coordinate-formats.d.ts +8 -0
  39. package/out/coordinate-formats.d.ts.map +1 -1
  40. package/out/coordinate-formats.js +14 -3
  41. package/out/coordinate-formats.js.map +1 -1
  42. package/out/distance.d.ts +84 -0
  43. package/out/distance.d.ts.map +1 -0
  44. package/out/distance.js +132 -0
  45. package/out/distance.js.map +1 -0
  46. package/out/feature.d.ts +1 -1
  47. package/out/feature.d.ts.map +1 -1
  48. package/out/feature.js.map +1 -1
  49. package/out/geometries/collection.d.ts +4 -4
  50. package/out/geometries/collection.d.ts.map +1 -1
  51. package/out/geometries/collection.js.map +1 -1
  52. package/out/geometries/index.d.ts +5 -4
  53. package/out/geometries/index.d.ts.map +1 -1
  54. package/out/geometries/index.js +5 -4
  55. package/out/geometries/index.js.map +1 -1
  56. package/out/geometries/line-string.d.ts +2 -2
  57. package/out/geometries/line-string.d.ts.map +1 -1
  58. package/out/geometries/line-string.js.map +1 -1
  59. package/out/geometries/point.d.ts +9 -9
  60. package/out/geometries/point.d.ts.map +1 -1
  61. package/out/geometries/point.js +9 -9
  62. package/out/geometries/point.js.map +1 -1
  63. package/out/geometries/polygon.d.ts +60 -56
  64. package/out/geometries/polygon.d.ts.map +1 -1
  65. package/out/geometries/polygon.js +66 -63
  66. package/out/geometries/polygon.js.map +1 -1
  67. package/out/geometries/ring-blob.d.ts +183 -0
  68. package/out/geometries/ring-blob.d.ts.map +1 -0
  69. package/out/geometries/ring-blob.js +376 -0
  70. package/out/geometries/ring-blob.js.map +1 -0
  71. package/out/google/index.d.ts +1 -1
  72. package/out/google/index.d.ts.map +1 -1
  73. package/out/google/index.js +1 -1
  74. package/out/google/index.js.map +1 -1
  75. package/out/google/place-id.d.ts.map +1 -1
  76. package/out/google/place-id.js.map +1 -1
  77. package/out/h3/cell.d.ts +32 -0
  78. package/out/h3/cell.d.ts.map +1 -1
  79. package/out/h3/cell.js +68 -1
  80. package/out/h3/cell.js.map +1 -1
  81. package/out/h3/coverage.d.ts +32 -0
  82. package/out/h3/coverage.d.ts.map +1 -0
  83. package/out/h3/coverage.js +27 -0
  84. package/out/h3/coverage.js.map +1 -0
  85. package/out/h3/index.d.ts +5 -3
  86. package/out/h3/index.d.ts.map +1 -1
  87. package/out/h3/index.js +5 -3
  88. package/out/h3/index.js.map +1 -1
  89. package/out/h3/interior-cells.d.ts +54 -0
  90. package/out/h3/interior-cells.d.ts.map +1 -0
  91. package/out/h3/interior-cells.js +111 -0
  92. package/out/h3/interior-cells.js.map +1 -0
  93. package/out/h3/polygon-cells.d.ts +182 -0
  94. package/out/h3/polygon-cells.d.ts.map +1 -0
  95. package/out/h3/polygon-cells.js +339 -0
  96. package/out/h3/polygon-cells.js.map +1 -0
  97. package/out/index.d.ts +15 -12
  98. package/out/index.d.ts.map +1 -1
  99. package/out/index.js +15 -12
  100. package/out/index.js.map +1 -1
  101. package/out/objects.d.ts +1 -1
  102. package/out/objects.d.ts.map +1 -1
  103. package/out/objects.js +1 -1
  104. package/out/objects.js.map +1 -1
  105. package/out/open-location-code.d.ts +48 -0
  106. package/out/open-location-code.d.ts.map +1 -0
  107. package/out/open-location-code.js +137 -0
  108. package/out/open-location-code.js.map +1 -0
  109. package/out/osgb36.d.ts +2 -2
  110. package/out/osgb36.d.ts.map +1 -1
  111. package/out/osgb36.js +1 -1
  112. package/out/osgb36.js.map +1 -1
  113. package/out/polyline.d.ts.map +1 -1
  114. package/out/polyline.js +1 -1
  115. package/out/polyline.js.map +1 -1
  116. package/out/position.d.ts +4 -61
  117. package/out/position.d.ts.map +1 -1
  118. package/out/position.js +14 -126
  119. package/out/position.js.map +1 -1
  120. package/out/projection-transform.d.ts +67 -0
  121. package/out/projection-transform.d.ts.map +1 -0
  122. package/out/projection-transform.js +48 -0
  123. package/out/projection-transform.js.map +1 -0
  124. package/out/projection.d.ts.map +1 -1
  125. package/out/projection.js.map +1 -1
  126. package/out/regions/codes.d.ts.map +1 -1
  127. package/out/regions/codes.js.map +1 -1
  128. package/out/regions/index.d.ts +2 -2
  129. package/out/regions/index.d.ts.map +1 -1
  130. package/out/regions/index.js +2 -2
  131. package/out/regions/index.js.map +1 -1
  132. package/out/regions/names.d.ts.map +1 -1
  133. package/out/regions/names.js.map +1 -1
  134. package/out/tools/ogr-stream.d.ts +34 -0
  135. package/out/tools/ogr-stream.d.ts.map +1 -0
  136. package/out/tools/ogr-stream.js +74 -0
  137. package/out/tools/ogr-stream.js.map +1 -0
  138. package/out/tools/ogr.d.ts +87 -0
  139. package/out/tools/ogr.d.ts.map +1 -0
  140. package/out/tools/ogr.js +84 -0
  141. package/out/tools/ogr.js.map +1 -0
  142. package/out/tsconfig.test.tsbuildinfo +1 -1
  143. package/out/{sdk/well-known-text.d.ts → well-known-text.d.ts} +1 -1
  144. package/out/well-known-text.d.ts.map +1 -0
  145. package/out/well-known-text.js.map +1 -0
  146. package/package.json +143 -14
  147. package/geometries/index.ts +0 -12
  148. package/index.ts +0 -18
  149. package/out/sdk/index.d.ts +0 -7
  150. package/out/sdk/index.d.ts.map +0 -1
  151. package/out/sdk/index.js +0 -7
  152. package/out/sdk/index.js.map +0 -1
  153. package/out/sdk/well-known-text.d.ts.map +0 -1
  154. package/out/sdk/well-known-text.js.map +0 -1
  155. package/out/tsconfig.tsbuildinfo +0 -1
  156. package/position.ts +0 -345
  157. package/sdk/index.ts +0 -7
  158. /package/{google → lib/google}/place-id.ts +0 -0
  159. /package/{projection.ts → lib/projection.ts} +0 -0
  160. /package/{regions → lib/regions}/names.ts +0 -0
  161. /package/out/{sdk/well-known-text.js → well-known-text.js} +0 -0
@@ -0,0 +1,48 @@
1
+ import { runFile } from "@mailwoman/core/process";
2
+ /**
3
+ * Read `projinfo --summary` output: which operation PROJ would choose, and whether it can actually run.
4
+ */
5
+ export function assessDatumTransformation(summary) {
6
+ // The first line naming a candidate operation is the one PROJ will choose. Everything before it is a header, and the
7
+ // `Note:` line about `--spatial-test` is not a candidate.
8
+ //
9
+ // `projinfo --summary` prints a header plus one line per candidate operation: two to nine lines, bounded by PROJ's own
10
+ // candidate enumeration rather than by input size. Reaching for a streaming reader would put a `spliterator` dependency
11
+ // on this package for a fixed handful of lines.
12
+ // oxlint-disable-next-line mailwoman/prefer-spliterator -- bounded output, see above
13
+ const lines = summary.split("\n");
14
+ const best = lines
15
+ .map((line) => line.trim())
16
+ .find((line) => line.includes(", ") && !line.startsWith("Note:") && !line.startsWith("Candidate operations"));
17
+ if (!best)
18
+ return { usable: false, reason: "projinfo named no candidate operation" };
19
+ if (best.includes("grid missing"))
20
+ return { best, usable: false, reason: "its grid is not installed" };
21
+ if (best.toLowerCase().includes("ballpark"))
22
+ return { best, usable: false, reason: "it is a ballpark offset" };
23
+ return { best, usable: true, reason: "the best operation is available" };
24
+ }
25
+ /**
26
+ * The target every layer ingest reprojects to — H3 takes WGS84 latitude and longitude.
27
+ */
28
+ export const WGS84_EPSG = 4326;
29
+ /**
30
+ * Refuse an ingest whose best available datum transformation is a ballpark one, or is missing its grid.
31
+ *
32
+ * @throws {Error} When PROJ names no candidate, would use a ballpark offset, or would use an operation whose grid is
33
+ * not installed.
34
+ */
35
+ export async function assertDatumTransformationAvailable(sourceEPSG, options) {
36
+ const targetEPSG = options.targetEPSG ?? WGS84_EPSG;
37
+ const { stdout } = await runFile("projinfo", ["-s", `EPSG:${sourceEPSG}`, "-t", `EPSG:${targetEPSG}`, "--summary"]);
38
+ const verdict = assessDatumTransformation(stdout);
39
+ if (verdict.usable)
40
+ return verdict;
41
+ const remedy = options.areaOfUse
42
+ ? `Install the grid with \`projsync --area-of-use "${options.areaOfUse}"\` and re-run.`
43
+ : "Install the grid with `projsync` for the source's area of use and re-run.";
44
+ throw new Error(`${options.context}: the best EPSG:${sourceEPSG} → EPSG:${targetEPSG} transformation is unusable — ${verdict.reason} ` +
45
+ `(${verdict.best ?? "projinfo named no candidate"}). PROJ falls back to a ballpark datum shift, which is metres ` +
46
+ `wrong and looks exactly like a correct answer. ${remedy}`);
47
+ }
48
+ //# sourceMappingURL=projection-transform.js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AKG;AACH,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACvD,UAAkB,EAClB,OAAyC;IAEzC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,UAAU,CAAA;IAEnD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,QAAQ,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,UAAU,EAAE,EAAE,WAAW,CAAC,CAAC,CAAA;IAEnH,MAAM,OAAO,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAA;IAEjD,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,OAAO,CAAA;IAElC,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS;QAC/B,CAAC,CAAC,mDAAmD,OAAO,CAAC,SAAS,iBAAiB;QACvF,CAAC,CAAC,2EAA2E,CAAA;IAE9E,MAAM,IAAI,KAAK,CACd,GAAG,OAAO,CAAC,OAAO,mBAAmB,UAAU,WAAW,UAAU,iCAAiC,OAAO,CAAC,MAAM,GAAG;QACrH,IAAI,OAAO,CAAC,IAAI,IAAI,6BAA6B,gEAAgE;QACjH,kDAAkD,MAAM,EAAE,CAC3D,CAAA;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../projection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;IAChC;;;;OAIG;;IAEH;;OAEG;;CAEM,CAAA;AAEV,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAA"}
1
+ {"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../lib/projection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;IAChC;;;;OAIG;;IAEH;;OAEG;;CAEM,CAAA;AAEV,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"projection.js","sourceRoot":"","sources":["../projection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IACnC;;;;OAIG;IACH,KAAK,EAAE,MAAM;IACb;;OAEG;IACH,KAAK,EAAE,MAAM;CACJ,CAAA"}
1
+ {"version":3,"file":"projection.js","sourceRoot":"","sources":["../lib/projection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IACnC;;;;OAIG;IACH,KAAK,EAAE,MAAM;IACb;;OAEG;IACH,KAAK,EAAE,MAAM;CACJ,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../regions/codes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,eAAO,MAAM,WAAW,qDASc,CAAA;AAEtC;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAErD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;CAQgB,CAAA"}
1
+ {"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../lib/regions/codes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,eAAO,MAAM,WAAW,qDASc,CAAA;AAEtC;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAErD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;CAQgB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"codes.js","sourceRoot":"","sources":["../../regions/codes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;CACiC,CAAA;AAStC;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACrC,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,eAAe;IACnB,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,eAAe;CAC+B,CAAA"}
1
+ {"version":3,"file":"codes.js","sourceRoot":"","sources":["../../lib/regions/codes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;CACiC,CAAA;AAStC;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACrC,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,eAAe;IACnB,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,eAAe;CAC+B,CAAA"}
@@ -3,6 +3,6 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  */
6
- export * from "./codes.ts";
7
- export * from "./names.ts";
6
+ export * from "#regions/codes";
7
+ export * from "#regions/names";
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../regions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/regions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA"}
@@ -3,6 +3,6 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  */
6
- export * from "./codes.js";
7
- export * from "./names.js";
6
+ export * from "#regions/codes";
7
+ export * from "#regions/names";
8
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../regions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/regions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"names.d.ts","sourceRoot":"","sources":["../../regions/names.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,eAAO,MAAM,WAAW,kGAQc,CAAA;AAEtC;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA"}
1
+ {"version":3,"file":"names.d.ts","sourceRoot":"","sources":["../../lib/regions/names.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,eAAO,MAAM,WAAW,kGAQc,CAAA;AAEtC;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"names.js","sourceRoot":"","sources":["../../regions/names.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,QAAQ;IACR,YAAY;IACZ,MAAM;IACN,QAAQ;IACR,eAAe;IACf,SAAS;IACT,eAAe;CACsB,CAAA"}
1
+ {"version":3,"file":"names.js","sourceRoot":"","sources":["../../lib/regions/names.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,QAAQ;IACR,YAAY;IACZ,MAAM;IACN,QAAQ;IACR,eAAe;IACf,SAAS;IACT,eAAe;CACsB,CAAA"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file One ogr2ogr harness for every streaming extraction.
6
+ */
7
+ export interface OGRProcess {
8
+ stdout: NodeJS.ReadableStream;
9
+ /**
10
+ * Resolves on a clean exit; rejects with the exit code and the stderr tail otherwise. A truncated stream reads as a
11
+ * short but well-formed feature list, which is exactly the partial result that must throw rather than be reported as
12
+ * a smaller extract — so consume the stream fully, then await this.
13
+ */
14
+ settled: Promise<void>;
15
+ /**
16
+ * Stop the child if it is still running — the `finally` companion for a consumer that throws mid-stream.
17
+ */
18
+ kill: () => void;
19
+ }
20
+ /**
21
+ * Spawn `ogr2ogr` with stderr accumulated for the failure message. The caller owns the stdout format (GeoJSONSeq, CSV,
22
+ * …) and its parsing; {@link ogr2ogrGeoJSONSeq} is the GeoJSONSeq reading over this.
23
+ */
24
+ export declare function spawnOGR2OGR(args: readonly string[], context: string): OGRProcess;
25
+ /**
26
+ * Stream a GeoJSONSeq extraction as parsed features.
27
+ *
28
+ * Strips the RFC-8142 record separator (U+001E) GDAL MAY prefix records with — `.trim()` does not remove it (not
29
+ * whitespace), so an RS-framed record would fail to parse and be silently skipped, all of them, and an empty extract
30
+ * would read as a real absence. A malformed record is tolerated (skipped) rather than thrown; a non-zero exit throws
31
+ * after the stream drains.
32
+ */
33
+ export declare function ogr2ogrGeoJSONSeq<T>(args: readonly string[], context: string): AsyncGenerator<T>;
34
+ //# sourceMappingURL=ogr-stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ogr-stream.d.ts","sourceRoot":"","sources":["../../lib/tools/ogr-stream.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,MAAM,WAAW,UAAU;IAC1B,MAAM,EAAE,MAAM,CAAC,cAAc,CAAA;IAC7B;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAA;CAChB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,CAoCjF;AAED;;;;;;;GAOG;AACH,wBAAuB,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CAoBvG"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file One ogr2ogr harness for every streaming extraction.
6
+ */
7
+ import { tryParsingJSON } from "@mailwoman/core/json";
8
+ import { spawnProcess } from "@mailwoman/core/process";
9
+ import { TextSpliterator } from "spliterator";
10
+ const RECORD_SEPARATOR = 0x1e;
11
+ const STDERR_TAIL_CHARS = 800;
12
+ /**
13
+ * Spawn `ogr2ogr` with stderr accumulated for the failure message. The caller owns the stdout format (GeoJSONSeq, CSV,
14
+ * …) and its parsing; {@link ogr2ogrGeoJSONSeq} is the GeoJSONSeq reading over this.
15
+ */
16
+ export function spawnOGR2OGR(args, context) {
17
+ const child = spawnProcess("ogr2ogr", [...args], { stdio: ["ignore", "pipe", "pipe"] });
18
+ let stderr = "";
19
+ child.stderr.setEncoding("utf8");
20
+ child.stderr.on("data", (chunk) => {
21
+ stderr += chunk;
22
+ });
23
+ const settled = new Promise((resolve, reject) => {
24
+ child.on("error", reject);
25
+ child.on("close", (code) => {
26
+ if (code === 0) {
27
+ resolve();
28
+ }
29
+ else {
30
+ reject(new Error(`${context}: ogr2ogr exited ${code}: ${stderr.slice(-STDERR_TAIL_CHARS)}`));
31
+ }
32
+ });
33
+ });
34
+ // A failed spawn rejects `settled` BEFORE any consumer awaits it — the consumer is still draining the stream on a
35
+ // later tick, and a consumer that abandons the stream never awaits it at all — so an unobserved rejection would trip
36
+ // the process's unhandled-rejection hook. Observed at birth instead; every consumer still awaits the real verdict.
37
+ settled.catch(() => undefined);
38
+ return {
39
+ stdout: child.stdout,
40
+ settled,
41
+ kill: () => {
42
+ if (child.exitCode === null && child.signalCode === null) {
43
+ child.kill();
44
+ }
45
+ },
46
+ };
47
+ }
48
+ /**
49
+ * Stream a GeoJSONSeq extraction as parsed features.
50
+ *
51
+ * Strips the RFC-8142 record separator (U+001E) GDAL MAY prefix records with — `.trim()` does not remove it (not
52
+ * whitespace), so an RS-framed record would fail to parse and be silently skipped, all of them, and an empty extract
53
+ * would read as a real absence. A malformed record is tolerated (skipped) rather than thrown; a non-zero exit throws
54
+ * after the stream drains.
55
+ */
56
+ export async function* ogr2ogrGeoJSONSeq(args, context) {
57
+ const proc = spawnOGR2OGR(args, context);
58
+ try {
59
+ for await (const raw of TextSpliterator.fromAsync(proc.stdout)) {
60
+ const line = (raw.charCodeAt(0) === RECORD_SEPARATOR ? raw.slice(1) : raw).trim();
61
+ if (!line)
62
+ continue;
63
+ const feature = tryParsingJSON(line);
64
+ if (feature !== null) {
65
+ yield feature;
66
+ }
67
+ }
68
+ }
69
+ finally {
70
+ proc.kill();
71
+ }
72
+ await proc.settled;
73
+ }
74
+ //# sourceMappingURL=ogr-stream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ogr-stream.js","sourceRoot":"","sources":["../../lib/tools/ogr-stream.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,y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,CAAC,MAAM;QACpB,OAAO;QACP,IAAI,EAAE,GAAG,EAAE;YACV,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;gBAC1D,KAAK,CAAC,IAAI,EAAE,CAAA;YACb,CAAC;QACF,CAAC;KACD,CAAA;AACF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,iBAAiB,CAAI,IAAuB,EAAE,OAAe;IACnF,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAExC,IAAI,CAAC;QACJ,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YAChE,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;YAEjF,IAAI,CAAC,IAAI;gBAAE,SAAQ;YAEnB,MAAM,OAAO,GAAG,cAAc,CAAI,IAAI,CAAC,CAAA;YAEvC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;gBACtB,MAAM,OAAO,CAAA;YACd,CAAC;QACF,CAAC;IACF,CAAC;YAAS,CAAC;QACV,IAAI,CAAC,IAAI,EAAE,CAAA;IACZ,CAAC;IAED,MAAM,IAAI,CAAC,OAAO,CAAA;AACnB,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * @copyright Sister Software.
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * What an OGR-readable source declares about itself, read before any feature is — the identity check every
7
+ * polygon-layer ingest opens with.
8
+ *
9
+ * OGR IS BUILD TOOLING, NEVER A SERVE DEPENDENCY (SCOPE invariant 6). The check refuses a source whose
10
+ * declared authority code is not the one the ingest was written for, because reading one projection's
11
+ * coordinates as another's is silent — and it runs the datum-transformation guard even where no shift is
12
+ * needed, because skipping it on the reasoning that a source needs no shift makes the guard fire on the day
13
+ * a source arrives that does.
14
+ */
15
+ /**
16
+ * What one layer declares about itself.
17
+ */
18
+ export interface OGRLayerIdentity {
19
+ epsg: number;
20
+ featureCount: number;
21
+ layer: string;
22
+ /**
23
+ * The layer's own attribute field names — empty when the source reports none.
24
+ */
25
+ fields: ReadonlySet<string>;
26
+ /**
27
+ * The layer's own declared extent, `[minLon, minLat, maxLon, maxLat]`, where the source declares one.
28
+ */
29
+ extent?: readonly [number, number, number, number];
30
+ }
31
+ export interface ReadOGRLayerIdentityOptions {
32
+ /**
33
+ * The dataset `ogrinfo` opens — a geodatabase directory, a shapefile, a GeoJSON export.
34
+ */
35
+ path: string;
36
+ /**
37
+ * Layer inside it, asserted against what the source answers. Omitted, the source's first layer answers and only its
38
+ * presence is checked.
39
+ */
40
+ layer?: string;
41
+ /**
42
+ * The EPSG code the source must declare. A source declaring anything else is a product change, not a variation to
43
+ * absorb.
44
+ */
45
+ expectEPSG: number;
46
+ /**
47
+ * Names the calling ingest in every refusal, e.g. `flood ingest`.
48
+ */
49
+ context: string;
50
+ /**
51
+ * Forwarded to the datum-transformation guard.
52
+ */
53
+ areaOfUse?: string;
54
+ /**
55
+ * Refuse a layer that declares no extent.
56
+ */
57
+ requireExtent?: boolean;
58
+ /**
59
+ * Refuse a layer that reports no attribute fields.
60
+ */
61
+ requireFields?: boolean;
62
+ /**
63
+ * A product's own message tails, where they diverge from the defaults.
64
+ */
65
+ messages?: {
66
+ /**
67
+ * After `declares no EPSG authority code — `.
68
+ */
69
+ noAuthorityCode?: string;
70
+ /**
71
+ * After `expected EPSG:<code> — `.
72
+ */
73
+ epsgMismatch?: string;
74
+ /**
75
+ * After `reports no attribute fields — `.
76
+ */
77
+ emptyFields?: string;
78
+ };
79
+ }
80
+ /**
81
+ * Read what the source declares about itself, and refuse a projection the calling ingest was not written for.
82
+ *
83
+ * @throws {Error} When the layer is missing, declares no EPSG authority code, declares one other than `expectEPSG`,
84
+ * reports no feature count, or fails a `requireExtent`/`requireFields` condition.
85
+ */
86
+ export declare function readOGRLayerIdentity(options: ReadOGRLayerIdentityOptions): Promise<OGRLayerIdentity>;
87
+ //# sourceMappingURL=ogr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ogr.d.ts","sourceRoot":"","sources":["../../lib/tools/ogr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CAClD;AAED,MAAM,WAAW,2BAA2B;IAC3C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE;QACV;;WAEG;QACH,eAAe,CAAC,EAAE,MAAM,CAAA;QACxB;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;CACD;AAaD;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAgG1G"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * @copyright Sister Software.
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * What an OGR-readable source declares about itself, read before any feature is — the identity check every
7
+ * polygon-layer ingest opens with.
8
+ *
9
+ * OGR IS BUILD TOOLING, NEVER A SERVE DEPENDENCY (SCOPE invariant 6). The check refuses a source whose
10
+ * declared authority code is not the one the ingest was written for, because reading one projection's
11
+ * coordinates as another's is silent — and it runs the datum-transformation guard even where no shift is
12
+ * needed, because skipping it on the reasoning that a source needs no shift makes the guard fire on the day
13
+ * a source arrives that does.
14
+ */
15
+ import { parseJSONStrict } from "@mailwoman/core/json";
16
+ import { runFile } from "@mailwoman/core/process";
17
+ import { assertDatumTransformationAvailable } from "#projection-transform";
18
+ /**
19
+ * A summary is small; the ceiling only guards against a pathological driver.
20
+ */
21
+ const OGRINFO_MAX_BUFFER = 32 * 1024 * 1024;
22
+ /**
23
+ * Ordinates in a 2D extent: `minLon, minLat, maxLon, maxLat`. A shorter array is a 3D or degenerate extent this reader
24
+ * does not understand, not a 2D one with something missing.
25
+ */
26
+ const EXTENT_ORDINATES = 4;
27
+ /**
28
+ * Read what the source declares about itself, and refuse a projection the calling ingest was not written for.
29
+ *
30
+ * @throws {Error} When the layer is missing, declares no EPSG authority code, declares one other than `expectEPSG`,
31
+ * reports no feature count, or fails a `requireExtent`/`requireFields` condition.
32
+ */
33
+ export async function readOGRLayerIdentity(options) {
34
+ const { stdout } = await runFile("ogrinfo", ["-json", "-so", options.path, ...(options.layer === undefined ? [] : [options.layer])], { maxBuffer: OGRINFO_MAX_BUFFER });
35
+ const info = parseJSONStrict(stdout);
36
+ const described = info.layers?.[0];
37
+ if (!described?.name) {
38
+ throw new Error(options.layer === undefined
39
+ ? `${options.context}: ${options.path} carries no readable layer`
40
+ : `${options.context}: ${options.path} does not carry a layer named ${JSON.stringify(options.layer)}`);
41
+ }
42
+ if (options.layer !== undefined && described.name !== options.layer) {
43
+ throw new Error(`${options.context}: ${options.path} does not carry a layer named ${JSON.stringify(options.layer)}`);
44
+ }
45
+ // The subject a refusal names: the layer where one was asked for, the dataset itself where the source's own first
46
+ // layer answered.
47
+ const subject = options.layer ?? options.path;
48
+ const geometry = described.geometryFields?.[0];
49
+ const code = geometry?.coordinateSystem?.projjson?.id?.code;
50
+ if (typeof code !== "number") {
51
+ throw new TypeError(`${options.context}: ${subject} declares no EPSG authority code — ${options.messages?.noAuthorityCode ??
52
+ "the projection cannot be checked, and reading its metres as degrees is silent"}`);
53
+ }
54
+ if (code !== options.expectEPSG) {
55
+ throw new Error(`${options.context}: ${subject} declares EPSG:${code}, expected EPSG:${options.expectEPSG} — ${options.messages?.epsgMismatch ??
56
+ "the source's projection changed, which is a product change rather than a variation to absorb"}`);
57
+ }
58
+ if (typeof described.featureCount !== "number") {
59
+ throw new TypeError(`${options.context}: ${subject} reports no feature count`);
60
+ }
61
+ let extent;
62
+ if (geometry?.extent && geometry.extent.length >= EXTENT_ORDINATES) {
63
+ extent = [geometry.extent[0], geometry.extent[1], geometry.extent[2], geometry.extent[3]];
64
+ }
65
+ if (options.requireExtent && !extent) {
66
+ throw new TypeError(`${options.context}: ${subject} declares no extent, so a reprojected vertex could not be checked`);
67
+ }
68
+ await assertDatumTransformationAvailable(code, {
69
+ context: options.context,
70
+ ...(options.areaOfUse === undefined ? {} : { areaOfUse: options.areaOfUse }),
71
+ });
72
+ const fields = new Set((described.fields ?? []).map((field) => field.name).filter((name) => name !== undefined));
73
+ if (options.requireFields && !fields.size) {
74
+ throw new TypeError(`${options.context}: ${subject} reports no attribute fields — ${options.messages?.emptyFields ?? "an empty field list would make every optional column read as absent"}`);
75
+ }
76
+ return {
77
+ epsg: code,
78
+ featureCount: described.featureCount,
79
+ layer: described.name,
80
+ fields,
81
+ ...(extent === undefined ? {} : { extent }),
82
+ };
83
+ }
84
+ //# s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AM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;KAC3C,CAAA;AACF,CAAC"}
@@ -1 +1 @@
1
- {"root":["../bbox.test.ts","../coordinate-formats.test.ts","../osgb36.test.ts","../position.test.ts","../geometries/point.test.ts","../geometries/polygon.test.ts","../google/place-id.test.ts","../h3/cell.test.ts","../sdk/well-known-text.test.ts"],"version":"6.0.3"}
1
+ {"root":["../test/unit/bbox.test.ts","../test/unit/coordinate-formats.test.ts","../test/unit/open-location-code.test.ts","../test/unit/osgb36.test.ts","../test/unit/position.test.ts","../test/unit/well-known-text.test.ts","../test/unit/geometries/point.test.ts","../test/unit/geometries/polygon.test.ts","../test/unit/google/place-id.test.ts","../test/unit/h3/cell.test.ts","../test/unit/h3/expand-short-cell-int.test.ts"],"version":"6.0.3"}
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Provides functions for parsing and converting extended Well-Known text and binary data.
7
7
  */
8
- import type { GeometryCollection, GeometryLiteral } from "@mailwoman/spatial";
8
+ import type { GeometryCollection, GeometryLiteral } from "#index";
9
9
  /**
10
10
  * Given an extended Well-Known Binary (EWKB) buffer, parse it into a GeoJSON geometry object.
11
11
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"well-known-text.d.ts","sourceRoot":"","sources":["../lib/well-known-text.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAEjE;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,GAAG,eAAe,EAAE,uBAAuB,EAAE,MAAM,GAAG,CAAC,CAAA;AACnG;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,GAAG,eAAe,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC,CAAA;AACzF;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,GAAG,eAAe,EAAE,KAAK,EAA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