@mailwoman/spatial 10.0.0 → 10.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/README.md +2 -2
  2. package/lib/bbox.ts +41 -34
  3. package/lib/coordinate/bounds.ts +2 -2
  4. package/lib/coordinate/formats.ts +10 -27
  5. package/lib/distance.ts +53 -27
  6. package/lib/feature.ts +2 -2
  7. package/lib/geometries/point.ts +41 -33
  8. package/lib/geometries/polygon.ts +24 -128
  9. package/lib/geometries/ring-blob.ts +33 -130
  10. package/lib/google/place-id.ts +4 -2
  11. package/lib/h3/cell.ts +21 -76
  12. package/lib/h3/coverage.ts +11 -7
  13. package/lib/h3/interior-cells.ts +13 -34
  14. package/lib/h3/polygon-cells.ts +59 -165
  15. package/lib/{h3/index.ts → h3.ts} +1 -1
  16. package/lib/index.ts +5 -5
  17. package/lib/objects.ts +6 -6
  18. package/lib/open-location-code.ts +11 -42
  19. package/lib/osgb36.ts +28 -187
  20. package/lib/polyline.ts +5 -3
  21. package/lib/position.ts +18 -2
  22. package/lib/projection/transform.ts +39 -40
  23. package/lib/{projection/index.ts → projection.ts} +1 -1
  24. package/lib/well-known-text.ts +8 -8
  25. package/out/bbox.d.ts +17 -14
  26. package/out/bbox.d.ts.map +1 -1
  27. package/out/bbox.js +32 -23
  28. package/out/bbox.js.map +1 -1
  29. package/out/coordinate/bounds.d.ts +2 -2
  30. package/out/coordinate/bounds.js +2 -2
  31. package/out/coordinate/formats.d.ts +8 -11
  32. package/out/coordinate/formats.d.ts.map +1 -1
  33. package/out/coordinate/formats.js +10 -27
  34. package/out/coordinate/formats.js.map +1 -1
  35. package/out/distance.d.ts +48 -25
  36. package/out/distance.d.ts.map +1 -1
  37. package/out/distance.js +53 -27
  38. package/out/distance.js.map +1 -1
  39. package/out/feature.d.ts +2 -2
  40. package/out/feature.d.ts.map +1 -1
  41. package/out/geometries/point.d.ts +30 -22
  42. package/out/geometries/point.d.ts.map +1 -1
  43. package/out/geometries/point.js +35 -29
  44. package/out/geometries/point.js.map +1 -1
  45. package/out/geometries/polygon.d.ts +23 -122
  46. package/out/geometries/polygon.d.ts.map +1 -1
  47. package/out/geometries/polygon.js +13 -41
  48. package/out/geometries/polygon.js.map +1 -1
  49. package/out/geometries/ring-blob.d.ts +23 -109
  50. package/out/geometries/ring-blob.d.ts.map +1 -1
  51. package/out/geometries/ring-blob.js +29 -115
  52. package/out/geometries/ring-blob.js.map +1 -1
  53. package/out/{geometries/index.js → geometries.d.ts} +1 -1
  54. package/out/geometries.d.ts.map +1 -0
  55. package/out/{geometries/index.d.ts → geometries.js} +1 -1
  56. package/out/geometries.js.map +1 -0
  57. package/out/google/place-id.d.ts +4 -2
  58. package/out/google/place-id.d.ts.map +1 -1
  59. package/out/google/place-id.js.map +1 -1
  60. package/out/{google/index.d.ts → google.d.ts} +1 -1
  61. package/out/google.d.ts.map +1 -0
  62. package/out/{google/index.js → google.js} +1 -1
  63. package/out/google.js.map +1 -0
  64. package/out/h3/cell.d.ts +19 -73
  65. package/out/h3/cell.d.ts.map +1 -1
  66. package/out/h3/cell.js +20 -63
  67. package/out/h3/cell.js.map +1 -1
  68. package/out/h3/coverage.d.ts +11 -7
  69. package/out/h3/coverage.d.ts.map +1 -1
  70. package/out/h3/coverage.js +11 -7
  71. package/out/h3/coverage.js.map +1 -1
  72. package/out/h3/interior-cells.d.ts +9 -28
  73. package/out/h3/interior-cells.d.ts.map +1 -1
  74. package/out/h3/interior-cells.js +13 -32
  75. package/out/h3/interior-cells.js.map +1 -1
  76. package/out/h3/polygon-cells.d.ts +28 -120
  77. package/out/h3/polygon-cells.d.ts.map +1 -1
  78. package/out/h3/polygon-cells.js +48 -146
  79. package/out/h3/polygon-cells.js.map +1 -1
  80. package/out/{h3/index.d.ts → h3.d.ts} +2 -2
  81. package/out/h3.d.ts.map +1 -0
  82. package/out/{h3/index.js → h3.js} +2 -2
  83. package/out/h3.js.map +1 -0
  84. package/out/index.d.ts +5 -5
  85. package/out/index.d.ts.map +1 -1
  86. package/out/index.js +5 -5
  87. package/out/index.js.map +1 -1
  88. package/out/objects.d.ts +6 -6
  89. package/out/open-location-code.d.ts +11 -22
  90. package/out/open-location-code.d.ts.map +1 -1
  91. package/out/open-location-code.js +9 -40
  92. package/out/open-location-code.js.map +1 -1
  93. package/out/osgb36.d.ts +21 -97
  94. package/out/osgb36.d.ts.map +1 -1
  95. package/out/osgb36.js +12 -165
  96. package/out/osgb36.js.map +1 -1
  97. package/out/polyline.d.ts +5 -3
  98. package/out/polyline.d.ts.map +1 -1
  99. package/out/polyline.js +5 -3
  100. package/out/polyline.js.map +1 -1
  101. package/out/position.d.ts +16 -2
  102. package/out/position.d.ts.map +1 -1
  103. package/out/position.js.map +1 -1
  104. package/out/projection/transform.d.ts +30 -27
  105. package/out/projection/transform.d.ts.map +1 -1
  106. package/out/projection/transform.js +14 -16
  107. package/out/projection/transform.js.map +1 -1
  108. package/out/{projection/index.d.ts → projection.d.ts} +2 -2
  109. package/out/projection.d.ts.map +1 -0
  110. package/out/{projection/index.js → projection.js} +2 -2
  111. package/out/projection.js.map +1 -0
  112. package/out/{regions/index.js → regions.d.ts} +1 -1
  113. package/out/regions.d.ts.map +1 -0
  114. package/out/{regions/index.d.ts → regions.js} +1 -1
  115. package/out/regions.js.map +1 -0
  116. package/out/tools/ogr/stream.d.ts +21 -11
  117. package/out/tools/ogr/stream.d.ts.map +1 -1
  118. package/out/tools/ogr/stream.js +16 -9
  119. package/out/tools/ogr/stream.js.map +1 -1
  120. package/out/tools/{ogr/index.d.ts → ogr.d.ts} +14 -11
  121. package/out/tools/ogr.d.ts.map +1 -0
  122. package/out/tools/{ogr/index.js → ogr.js} +18 -14
  123. package/out/tools/ogr.js.map +1 -0
  124. package/out/tools/tsconfig.tsbuildinfo +1 -0
  125. package/out/tsconfig.test.tsbuildinfo +1 -1
  126. package/out/well-known-text.d.ts +8 -8
  127. package/out/well-known-text.js +7 -7
  128. package/package.json +35 -127
  129. package/{lib/tools → tools}/ogr/stream.ts +25 -14
  130. package/{lib/tools/ogr/index.ts → tools/ogr.ts} +25 -19
  131. package/out/geometries/index.d.ts.map +0 -1
  132. package/out/geometries/index.js.map +0 -1
  133. package/out/google/index.d.ts.map +0 -1
  134. package/out/google/index.js.map +0 -1
  135. package/out/h3/index.d.ts.map +0 -1
  136. package/out/h3/index.js.map +0 -1
  137. package/out/projection/index.d.ts.map +0 -1
  138. package/out/projection/index.js.map +0 -1
  139. package/out/regions/index.d.ts.map +0 -1
  140. package/out/regions/index.js.map +0 -1
  141. package/out/tools/ogr/index.d.ts.map +0 -1
  142. package/out/tools/ogr/index.js.map +0 -1
  143. /package/lib/{geometries/index.ts → geometries.ts} +0 -0
  144. /package/lib/{google/index.ts → google.ts} +0 -0
  145. /package/lib/{regions/index.ts → regions.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"polyline.js","sourceRoot":"","sources":["../lib/polyline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,CAAS;IACtC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAClC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CACzB,QAAqC,EACrC,CAAS;IAET,MAAM,IAAI,GAAa,EAAE,CAAA;IACzB,IAAI,KAAK,GAAG,CAAC,CAAA;IAEb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAE,CAAA;QACrC,MAAM,CAAC,IAAI,EAA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C,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAA;IACrB,CAAC;IAED,IAAI,SAAS,GAAG,CAAC,GAAG,KAAK,CAAA;IAEzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAE,CAAA;QAEpB,IAAI,SAAS,IAAI,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/C,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,SAAS,GAAG,GAAG,CAAC,CAAA;YACxD,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAA;YACjC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAE,CAAA;YAErC,OAAO,CAAC,IAAI,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAA;QACnE,CAAC;QAED,SAAS,IAAI,GAAG,CAAA;IACjB,CAAC;IAED,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAA;IAEnC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
package/out/position.d.ts CHANGED
@@ -7,11 +7,25 @@
7
7
  */
8
8
  import type { LatLngLiteral } from "@googlemaps/google-maps-services-js";
9
9
  export { isValidLatitude, isValidLongitude } from "#coordinate/bounds";
10
+ /**
11
+ * A point in decimal degrees under the `latitude` and `longitude` keys.
12
+ */
13
+ export interface GeoCoordinate {
14
+ latitude: number;
15
+ longitude: number;
16
+ }
17
+ /**
18
+ * A point in decimal degrees under the `lat` and `lon` keys.
19
+ */
20
+ export interface LatLon {
21
+ lat: number;
22
+ lon: number;
23
+ }
10
24
  /**
11
25
  * An ordered pair of coordinates in the form of [longitude, latitude].
12
26
  *
13
- * Note that unlike the typical order, GeoJSON coordinates are in the order of [longitude, latitude] to match the order
14
- * of [x, y] in Cartesian coordinates.
27
+ * Note that unlike the typical order, GeoJSON coordinates are in the order of
28
+ * [longitude, latitude] to match the order of [x, y] in Cartesian coordinates.
15
29
  *
16
30
  * @category Position
17
31
  * @category GeoJSON
@@ -1 +1 @@
1
- {"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../lib/position.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AAIxE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAYtE;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B;;;;;OAKG;IACH,SAAS,EAAE,MAAM;IACjB;;;;;OAKG;IACH,QAAQ,EAAE,MAAM;CAChB,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,aAAa,CAE9F;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAE9F;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,aAAa,CAiBxF;AAED;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B;;;;;OAKG;IACH,SAAS,EAA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CAAA;IAErD,IAAI,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IAEjC,IAAI,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IAEjC,OAAO,OAAO,KAAK,CAAC,CAAC,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,CAAC,KAAK,QAAQ,CAAA;AAClE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,SAAiB;IAC9C,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;AACvD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAA;AAC1C,CAAC"}
@@ -3,65 +3,68 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Ask PROJ which datum transformation it would choose, and refuse a ballpark one.
6
+ * Ask PROJ which datum transformation it would choose. Refuse a ballpark operation.
7
7
  *
8
- * PROJ SUBSTITUTES A BALLPARK DATUM SHIFT WHEN THE ACCURATE GRID IS NOT ON DISK, AND IT DOES SO SILENTLY.
9
- * Measured on the EA flood product: with the OSGB36→WGS84 grid missing, ogr2ogr placed the first
10
- * feature's first vertex at `1.698151293, 52.648130027`; with `uk_os_OSTN15_NTv2_OSGBtoETRS.tif` present
11
- * it placed it at `1.698174628, 52.648157259` — 3.4 m apart. Both look like perfectly ordinary WGS84
12
- * coordinates, both pass a bounding-box check, and the whole layer is offset. It surfaced as eight
13
- * disagreements out of 59 against the authority's own OGC service, every one a point that fell into a
14
- * NEIGHBOURING sliver.
8
+ * PROJ silently substitutes a ballpark datum shift when the accurate grid is absent. On the EA flood product,
9
+ * `ogr2ogr` placed the first feature's first vertex at `1.698151293, 52.648130027` without the OSGB36→WGS84 grid.
10
+ * With `uk_os_OSTN15_NTv2_OSGBtoETRS.tif` present, it placed the vertex at `1.698174628, 52.648157259`, a distance
11
+ * of 3.4 m. Both coordinates look like ordinary WGS84 values and pass a bounding-box check. The layer is offset.
12
+ * The check found eight disagreements among 59 points against the authority's OGC service. Each point fell into a
13
+ * neighboring sliver.
15
14
  *
16
- * `--config PROJ_NETWORK ON` does not reach PROJ through GDAL 3.8, and `PROJ_ONLY_BEST=ON` was observed
17
- * not to refuse, so neither is a usable guard. What is usable is asking PROJ what it would do: `projinfo`
18
- * names the best candidate operation and says when a grid is missing.
15
+ * GDAL 3.8 does not pass `--config PROJ_NETWORK on` through to PROJ. Tests also showed that `PROJ_ONLY_BEST=on`
16
+ * does not refuse a ballpark shift. `projinfo` provides the usable check. Its output identifies the best candidate
17
+ * operation and reports a missing grid.
19
18
  *
20
- * IT IS RUN EVEN WHERE NO TRANSFORMATION IS NEEDED, AND THAT IS THE POINT. A source already in EPSG:4326
21
- * gets `Null geographic offset from WGS 84 to WGS 84, 0 m, World.` — trivially usable, and the check costs
22
- * one process. Skipping it on the reasoning that a source needs no shift makes the guard fire on the day
23
- * a source arrives that does, which is the day nobody is looking.
19
+ * The check runs even when a source needs no transformation. A source already in EPSG:4326 returns
20
+ * `Null geographic offset from WGS 84 to WGS 84, 0 m, World.` This operation is usable. The check costs one process.
21
+ * A skipped case would leave a later source's required grid unchecked.
24
22
  *
25
- * SHARED BY EVERY VECTOR INGEST, because the failure is a property of PROJ rather than of any product. The
26
- * parse is split from the spawn so it can be pinned against captured output: the two states it
27
- * distinguishes were observed from the same command on the same machine, before and after the grid was
28
- * installed, and they are the difference between a metre-accurate layer and a 3 m-offset one.
23
+ * Every vector ingest shares this check because the failure comes from PROJ rather than from a particular product.
24
+ * Output parsing is separate from process execution so tests can use captured output. The two output states came from the
25
+ * same command on the same machine before and after grid installation. One produced a meter-accurate layer. The
26
+ * other produced a 3 m offset.
29
27
  */
30
28
  /**
31
- * What PROJ would do, and whether it can actually do it.
29
+ * Reports the operation PROJ would choose and whether it can run it.
32
30
  */
33
31
  export interface DatumTransformationVerdict {
34
32
  /**
35
- * The candidate operation line PROJ named, verbatim. Absent when it named none.
33
+ * The candidate operation string returned by PROJ, verbatim.
34
+ *
35
+ * Absent when PROJ returned no candidate operation.
36
36
  */
37
37
  best?: string;
38
38
  usable: boolean;
39
39
  reason: string;
40
40
  }
41
41
  /**
42
- * Read `projinfo --summary` output: which operation PROJ would choose, and whether it can actually run.
42
+ * Reads `projinfo --summary` output.
43
+ *
44
+ * It reports which operation PROJ would choose and whether it can run it.
43
45
  */
44
46
  export declare function assessDatumTransformation(summary: string): DatumTransformationVerdict;
45
47
  /**
46
- * The target every layer ingest reprojects to — H3 takes WGS84 latitude and longitude.
48
+ * The target every layer ingest reprojects to.
49
+ * H3 takes WGS84 latitude and longitude.
47
50
  */
48
51
  export declare const WGS84_EPSG = 4326;
49
52
  export interface AssertDatumTransformationOptions {
50
53
  /**
51
- * Names the caller in the refusal, so a build log says which ingest stopped.
54
+ * Identifies the caller in the refusal, so a build log reports which ingest stopped.
52
55
  */
53
56
  context: string;
54
57
  targetEPSG?: number;
55
58
  /**
56
- * The area-of-use to name in the `projsync` remedy the message prints.
59
+ * The area-of-use to name in the `projsync` action the message prints.
57
60
  */
58
61
  areaOfUse?: string;
59
62
  }
60
63
  /**
61
64
  * Refuse an ingest whose best available datum transformation is a ballpark one, or is missing its grid.
62
65
  *
63
- * @throws {Error} When PROJ names no candidate, would use a ballpark offset, or would use an operation whose grid is
64
- * not installed.
66
+ * @throws {Error} When proj names no candidate, would use a ballpark offset,
67
+ * or would use an operation whose grid is not installed.
65
68
  */
66
69
  export declare function assertDatumTransformationAvailable(sourceEPSG: number, options: AssertDatumTransformationOptions): Promise<DatumTransformationVerdict>;
67
70
  //# sourceMappingURL=transform.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../lib/projection/transform.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,0BAA0B,CAqBrF;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,OAAO,CAAA;AAE9B,MAAM,WAAW,gCAAgC;IAChD;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;GAKG;AACH,wBAAsB,kCAAkC,CACvD,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,gCAAgC,GACvC,OAAO,CAAC,0BAA0B,CAAC,CAkBrC"}
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../lib/projection/transform.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;CACd;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,0BAA0B,CAgBrF;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,OAAO,CAAA;AAE9B,MAAM,WAAW,gCAAgC;IAChD;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;GAKG;AACH,wBAAsB,kCAAkC,CACvD,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,gCAAgC,GACvC,OAAO,CAAC,0BAA0B,CAAC,CAkBrC"}
@@ -1,19 +1,16 @@
1
1
  import { runFile } from "@mailwoman/core/process";
2
+ import { TextSpliterator } from "spliterator";
2
3
  /**
3
- * Read `projinfo --summary` output: which operation PROJ would choose, and whether it can actually run.
4
+ * Reads `projinfo --summary` output.
5
+ *
6
+ * It reports which operation PROJ would choose and whether it can run it.
4
7
  */
5
8
  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"));
9
+ // The first line naming a candidate operation is the one PROJ will choose.
10
+ // Earlier lines are headers.
11
+ // The `Note:` line about `--spatial-test` also describes no candidate operation.
12
+ // The reader trims each line.
13
+ const best = TextSpliterator.from(summary).find((line) => line.includes(", ") && !line.startsWith("Note:") && !line.startsWith("Candidate operations"));
17
14
  if (!best)
18
15
  return { usable: false, reason: "projinfo named no candidate operation" };
19
16
  if (best.includes("grid missing"))
@@ -23,14 +20,15 @@ export function assessDatumTransformation(summary) {
23
20
  return { best, usable: true, reason: "the best operation is available" };
24
21
  }
25
22
  /**
26
- * The target every layer ingest reprojects to — H3 takes WGS84 latitude and longitude.
23
+ * The target every layer ingest reprojects to.
24
+ * H3 takes WGS84 latitude and longitude.
27
25
  */
28
26
  export const WGS84_EPSG = 4326;
29
27
  /**
30
28
  * Refuse an ingest whose best available datum transformation is a ballpark one, or is missing its grid.
31
29
  *
32
- * @throws {Error} When PROJ names no candidate, would use a ballpark offset, or would use an operation whose grid is
33
- * not installed.
30
+ * @throws {Error} When proj names no candidate, would use a ballpark offset,
31
+ * or would use an operation whose grid is not installed.
34
32
  */
35
33
  export async function assertDatumTransformationAvailable(sourceEPSG, options) {
36
34
  const targetEPSG = options.targetEPSG ?? WGS84_EPSG;
@@ -42,7 +40,7 @@ export async function assertDatumTransformationAvailable(sourceEPSG, options) {
42
40
  ? `Install the grid with \`projsync --area-of-use "${options.areaOfUse}"\` and re-run.`
43
41
  : "Install the grid with `projsync` for the source's area of use and re-run.";
44
42
  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 ` +
43
+ `(${verdict.best ?? "projinfo named no candidate"}). PROJ falls back to a ballpark datum shift, which is meters ` +
46
44
  `wrong and looks exactly like a correct answer. ${remedy}`);
47
45
  }
48
46
  //# sourceMappingURL=transform.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform.js","sourceRoot":"","sources":["../../lib/projection/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AA4CjD;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAe;IACxD,qHAAqH;IACrH,0DAA0D;IAC1D,EAAE;IACF,uHAAuH;IACvH,wHAAwH;IACxH,gDAAgD;IAChD,qFAAqF;IACrF,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAEjC,MAAM,IAAI,GAAG,KAAK;SAChB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC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iCAAiC,EAAE,CAAA;AACzE,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAA;AAc9B;;;;;GAKG;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"}
@@ -16,9 +16,9 @@ export declare const CoordinateProjection: {
16
16
  */
17
17
  readonly WGS84: "4326";
18
18
  /**
19
- * North American Datum 1983, a geodetic reference system used in the TIGER/Line data.
19
+ * North American Datum 1983, a geodetic reference system used in the tiger/Line data.
20
20
  */
21
21
  readonly NAD83: "4269";
22
22
  };
23
23
  export type CoordinateProjection = (typeof CoordinateProjection)[keyof typeof CoordinateProjection];
24
- //# sourceMappingURL=index.d.ts.map
24
+ //# sourceMappingURL=projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../lib/projection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;IAChC;;;;OAIG;aACH,KAAK,EAAE,MAAM;IACb;;OAEG;aACH,KAAK,EAAE,MAAM;CACJ,CAAA;AAEV,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAA"}
@@ -16,8 +16,8 @@ export const CoordinateProjection = {
16
16
  */
17
17
  WGS84: "4326",
18
18
  /**
19
- * North American Datum 1983, a geodetic reference system used in the TIGER/Line data.
19
+ * North American Datum 1983, a geodetic reference system used in the tiger/Line data.
20
20
  */
21
21
  NAD83: "4269",
22
22
  };
23
- //# sourceMappingURL=index.js.map
23
+ //# sourceMappingURL=projection.js.map
@@ -0,0 +1 @@
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"}
@@ -5,4 +5,4 @@
5
5
  */
6
6
  export * from "#regions/codes";
7
7
  export * from "#regions/names";
8
- //# sourceMappingURL=index.js.map
8
+ //# sourceMappingURL=regions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regions.d.ts","sourceRoot":"","sources":["../lib/regions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA"}
@@ -5,4 +5,4 @@
5
5
  */
6
6
  export * from "#regions/codes";
7
7
  export * from "#regions/names";
8
- //# sourceMappingURL=index.d.ts.map
8
+ //# sourceMappingURL=regions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regions.js","sourceRoot":"","sources":["../lib/regions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA"}
@@ -4,12 +4,16 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  * @file One ogr2ogr harness for every streaming extraction.
6
6
  */
7
+ import type { PathBuilderLike } from "path-ts";
7
8
  export interface OGRProcess {
8
9
  stdout: NodeJS.ReadableStream;
9
10
  /**
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.
11
+ * Resolves on a clean exit.
12
+ * Rejects with the exit code and the stderr tail otherwise.
13
+ *
14
+ * A truncated stream can look like a shorter, valid feature list.
15
+ * That partial result must raise an error instead of looking like a smaller extract.
16
+ * Consume the stream fully, then await this promise.
13
17
  */
14
18
  settled: Promise<void>;
15
19
  /**
@@ -18,17 +22,23 @@ export interface OGRProcess {
18
22
  kill: () => void;
19
23
  }
20
24
  /**
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.
25
+ * Spawn `ogr2ogr` with stderr accumulated for the failure message.
26
+ *
27
+ * The caller owns the stdout format (GeoJSONSeq, CSV, …) and its parsing;
28
+ * {@link ogr2ogrGeoJSONSeq} is the GeoJSONSeq reading over this.
23
29
  */
24
- export declare function spawnOGR2OGR(args: readonly string[], context: string): OGRProcess;
30
+ export declare function spawnOGR2OGR(args: readonly PathBuilderLike[], context: string): OGRProcess;
25
31
  /**
26
32
  * Stream a GeoJSONSeq extraction as parsed features.
27
33
  *
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.
34
+ * Strips the RFC-8142 record separator (U+001E) gdal may prefix records with.
35
+ * `.trim()` leaves U+001E intact.
36
+ *
37
+ * The parser strips it first because `tryParsingJSON` would otherwise skip each RS-prefixed record.
38
+ * If the code skipped every record, an empty extract would look like a real absence.
39
+ *
40
+ * A malformed record is tolerated (skipped) rather than thrown.
41
+ * A non-zero exit throws after the stream drains.
32
42
  */
33
- export declare function ogr2ogrGeoJSONSeq<T>(args: readonly string[], context: string): AsyncGenerator<T>;
43
+ export declare function ogr2ogrGeoJSONSeq<T>(args: readonly PathBuilderLike[], context: string): AsyncGenerator<T>;
34
44
  //# sourceMappingURL=stream.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"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"}
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../tools/ogr/stream.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAM9C,MAAM,WAAW,UAAU;IAC1B,MAAM,EAAE,MAAM,CAAC,cAAc,CAAA;IAC7B;;;;;;;OAOG;IACH,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAA;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,eAAe,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,CAqC1F;AAED;;;;;;;;;;;GAWG;AACH,wBAAuB,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,eAAe,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CAoBhH"}
@@ -10,8 +10,10 @@ import { TextSpliterator } from "spliterator";
10
10
  const RECORD_SEPARATOR = 0x1e;
11
11
  const STDERR_TAIL_CHARS = 800;
12
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.
13
+ * Spawn `ogr2ogr` with stderr accumulated for the failure message.
14
+ *
15
+ * The caller owns the stdout format (GeoJSONSeq, CSV, …) and its parsing;
16
+ * {@link ogr2ogrGeoJSONSeq} is the GeoJSONSeq reading over this.
15
17
  */
16
18
  export function spawnOGR2OGR(args, context) {
17
19
  const child = spawnProcess("ogr2ogr", [...args], { stdio: ["ignore", "pipe", "pipe"] });
@@ -31,9 +33,10 @@ export function spawnOGR2OGR(args, context) {
31
33
  }
32
34
  });
33
35
  });
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.
36
+ // A failed spawn can reject `settled` before a consumer awaits it.
37
+ // A consumer may still be draining stdout on a later tick or may abandon the stream.
38
+ // Attach a handler at birth to prevent an unhandled-rejection event.
39
+ // Every consumer still awaits the real verdict.
37
40
  settled.catch(() => undefined);
38
41
  return {
39
42
  stdout: child.stdout,
@@ -48,10 +51,14 @@ export function spawnOGR2OGR(args, context) {
48
51
  /**
49
52
  * Stream a GeoJSONSeq extraction as parsed features.
50
53
  *
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.
54
+ * Strips the RFC-8142 record separator (U+001E) gdal may prefix records with.
55
+ * `.trim()` leaves U+001E intact.
56
+ *
57
+ * The parser strips it first because `tryParsingJSON` would otherwise skip each RS-prefixed record.
58
+ * If the code skipped every record, an empty extract would look like a real absence.
59
+ *
60
+ * A malformed record is tolerated (skipped) rather than thrown.
61
+ * A non-zero exit throws after the stream drains.
55
62
  */
56
63
  export async function* ogr2ogrGeoJSONSeq(args, context) {
57
64
  const proc = spawnOGR2OGR(args, context);
@@ -1 +1 @@
1
- {"version":3,"file":"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,yBAAyB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C,MAAM,gBAAgB,GAAG,IAAI,CAAA;AAC7B,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAgB7B;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAuB,EAAE,OAAe;IACpE,MAAM,KAAK,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;IACvF,IAAI,MAAM,GAAG,EAAE,CAAA;IAEf,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,C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,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"}
@@ -6,7 +6,7 @@
6
6
  * What an OGR-readable source declares about itself, read before any feature is — the identity check every
7
7
  * polygon-layer ingest opens with.
8
8
  *
9
- * OGR IS BUILD TOOLING, NEVER A SERVE DEPENDENCY (SCOPE invariant 6). The check refuses a source whose
9
+ * OGR is build tooling, never A serve dependency (scope invariant 6). The check refuses a source whose
10
10
  * declared authority code is not the one the ingest was written for, because reading one projection's
11
11
  * coordinates as another's is silent — and it runs the datum-transformation guard even where no shift is
12
12
  * needed, because skipping it on the reasoning that a source needs no shift makes the guard fire on the day
@@ -34,13 +34,15 @@ export interface ReadOGRLayerIdentityOptions {
34
34
  */
35
35
  path: string;
36
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.
37
+ * Layer inside it, asserted against what the source answers.
38
+ *
39
+ * Omitted, the source's first layer answers and only its presence is checked.
39
40
  */
40
41
  layer?: string;
41
42
  /**
42
- * The EPSG code the source must declare. A source declaring anything else is a product change, not a variation to
43
- * absorb.
43
+ * The epsg code the source must declare.
44
+ *
45
+ * A source declaring anything else is a product change rather than a variation to absorb.
44
46
  */
45
47
  expectEPSG: number;
46
48
  /**
@@ -64,11 +66,11 @@ export interface ReadOGRLayerIdentityOptions {
64
66
  */
65
67
  messages?: {
66
68
  /**
67
- * After `declares no EPSG authority code — `.
69
+ * After `declares no epsg authority code — `.
68
70
  */
69
71
  noAuthorityCode?: string;
70
72
  /**
71
- * After `expected EPSG:<code> — `.
73
+ * After `expected epsg:<code> — `.
72
74
  */
73
75
  epsgMismatch?: string;
74
76
  /**
@@ -78,10 +80,11 @@ export interface ReadOGRLayerIdentityOptions {
78
80
  };
79
81
  }
80
82
  /**
81
- * Read what the source declares about itself, and refuse a projection the calling ingest was not written for.
83
+ * Read what the source declares about itself.
84
+ * Refuse a projection the calling ingest was not written for.
82
85
  *
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.
86
+ * @throws {Error} When the layer is missing, declares no epsg authority code, declares one other than
87
+ * `expectEPSG`, reports no feature count, or fails a `requireExtent`/`requireFields` condition.
85
88
  */
86
89
  export declare function readOGRLayerIdentity(options: ReadOGRLayerIdentityOptions): Promise<OGRLayerIdentity>;
87
- //# sourceMappingURL=index.d.ts.map
90
+ //# sourceMappingURL=ogr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ogr.d.ts","sourceRoot":"","sources":["../../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;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;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;AAgBD;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAgG1G"}
@@ -6,29 +6,33 @@
6
6
  * What an OGR-readable source declares about itself, read before any feature is — the identity check every
7
7
  * polygon-layer ingest opens with.
8
8
  *
9
- * OGR IS BUILD TOOLING, NEVER A SERVE DEPENDENCY (SCOPE invariant 6). The check refuses a source whose
9
+ * OGR is build tooling, never A serve dependency (scope invariant 6). The check refuses a source whose
10
10
  * declared authority code is not the one the ingest was written for, because reading one projection's
11
11
  * coordinates as another's is silent — and it runs the datum-transformation guard even where no shift is
12
12
  * needed, because skipping it on the reasoning that a source needs no shift makes the guard fire on the day
13
13
  * a source arrives that does.
14
14
  */
15
- import { parseJSONStrict } from "@mailwoman/core/json";
15
+ import { parseJSONStrict, stringifyJSON } from "@mailwoman/core/json";
16
16
  import { runFile } from "@mailwoman/core/process";
17
17
  import { assertDatumTransformationAvailable } from "#projection/transform";
18
18
  /**
19
- * A summary is small; the ceiling only guards against a pathological driver.
19
+ * A summary is small.
20
+ * The ceiling only guards against a pathological driver.
20
21
  */
21
22
  const OGRINFO_MAX_BUFFER = 32 * 1024 * 1024;
22
23
  /**
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.
24
+ * Ordinates in a 2D extent: `minLon, minLat, maxLon, maxLat`.
25
+ *
26
+ * A shorter array is a 3D or degenerate extent this reader does not understand
27
+ * rather than a 2D one with something missing.
25
28
  */
26
29
  const EXTENT_ORDINATES = 4;
27
30
  /**
28
- * Read what the source declares about itself, and refuse a projection the calling ingest was not written for.
31
+ * Read what the source declares about itself.
32
+ * Refuse a projection the calling ingest was not written for.
29
33
  *
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.
34
+ * @throws {Error} When the layer is missing, declares no epsg authority code, declares one other than
35
+ * `expectEPSG`, reports no feature count, or fails a `requireExtent`/`requireFields` condition.
32
36
  */
33
37
  export async function readOGRLayerIdentity(options) {
34
38
  const { stdout } = await runFile("ogrinfo", ["-json", "-so", options.path, ...(options.layer === undefined ? [] : [options.layer])], { maxBuffer: OGRINFO_MAX_BUFFER });
@@ -37,19 +41,19 @@ export async function readOGRLayerIdentity(options) {
37
41
  if (!described?.name) {
38
42
  throw new Error(options.layer === undefined
39
43
  ? `${options.context}: ${options.path} carries no readable layer`
40
- : `${options.context}: ${options.path} does not carry a layer named ${JSON.stringify(options.layer)}`);
44
+ : `${options.context}: ${options.path} does not carry a layer named ${stringifyJSON(options.layer)}`);
41
45
  }
42
46
  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)}`);
47
+ throw new Error(`${options.context}: ${options.path} does not carry a layer named ${stringifyJSON(options.layer)}`);
44
48
  }
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.
49
+ // The subject a refusal names: the layer where one was asked for, the dataset itself
50
+ // where the source's own first layer answered.
47
51
  const subject = options.layer ?? options.path;
48
52
  const geometry = described.geometryFields?.[0];
49
53
  const code = geometry?.coordinateSystem?.projjson?.id?.code;
50
54
  if (typeof code !== "number") {
51
55
  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"}`);
56
+ "the projection cannot be checked, and reading its meters as degrees is silent"}`);
53
57
  }
54
58
  if (code !== options.expectEPSG) {
55
59
  throw new Error(`${options.context}: ${subject} declares EPSG:${code}, expected EPSG:${options.expectEPSG} — ${options.messages?.epsgMismatch ??
@@ -81,4 +85,4 @@ export async function readOGRLayerIdentity(options) {
81
85
  ...(extent === undefined ? {} : { extent }),
82
86
  };
83
87
  }
84
- //# sourceMappingURL=index.js.map
88
+ //# sourceMappingURL=ogr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ogr.js","sourceRoot":"","sources":["../../tools/ogr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEjD,OAAO,EAAE,kCAAkC,EAAE,MAAM,uBAAuB,CAAA;AAuE1E;;;GAGG;AACH,MAAM,kBAAkB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;AAE3C;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAA;AAE1B;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAoC;IAC9E,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,OAAO,CAC/B,SAAS,EACT,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EACvF,EAAE,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