@mailwoman/spatial 9.4.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 (156) hide show
  1. package/README.md +2 -2
  2. package/lib/bbox.ts +41 -34
  3. package/lib/{coordinate-bounds.ts → coordinate/bounds.ts} +2 -2
  4. package/lib/{coordinate-formats.ts → coordinate/formats.ts} +11 -28
  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 +6 -6
  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 +20 -4
  22. package/lib/projection/transform.ts +114 -0
  23. package/lib/projection.ts +1 -1
  24. package/lib/well-known-text.ts +8 -8
  25. package/out/bbox.d.ts +16 -13
  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 → coordinate/bounds.d.ts} +3 -3
  30. package/out/coordinate/bounds.d.ts.map +1 -0
  31. package/out/{coordinate-bounds.js → coordinate/bounds.js} +3 -3
  32. package/out/coordinate/bounds.js.map +1 -0
  33. package/out/{coordinate-formats.d.ts → coordinate/formats.d.ts} +9 -12
  34. package/out/coordinate/formats.d.ts.map +1 -0
  35. package/out/{coordinate-formats.js → coordinate/formats.js} +12 -29
  36. package/out/coordinate/formats.js.map +1 -0
  37. package/out/distance.d.ts +48 -25
  38. package/out/distance.d.ts.map +1 -1
  39. package/out/distance.js +53 -27
  40. package/out/distance.js.map +1 -1
  41. package/out/feature.d.ts +2 -2
  42. package/out/feature.d.ts.map +1 -1
  43. package/out/geometries/point.d.ts +30 -22
  44. package/out/geometries/point.d.ts.map +1 -1
  45. package/out/geometries/point.js +35 -29
  46. package/out/geometries/point.js.map +1 -1
  47. package/out/geometries/polygon.d.ts +23 -122
  48. package/out/geometries/polygon.d.ts.map +1 -1
  49. package/out/geometries/polygon.js +13 -41
  50. package/out/geometries/polygon.js.map +1 -1
  51. package/out/geometries/ring-blob.d.ts +23 -109
  52. package/out/geometries/ring-blob.d.ts.map +1 -1
  53. package/out/geometries/ring-blob.js +29 -115
  54. package/out/geometries/ring-blob.js.map +1 -1
  55. package/out/{geometries/index.js → geometries.d.ts} +1 -1
  56. package/out/geometries.d.ts.map +1 -0
  57. package/out/{geometries/index.d.ts → geometries.js} +1 -1
  58. package/out/geometries.js.map +1 -0
  59. package/out/google/place-id.d.ts +4 -2
  60. package/out/google/place-id.d.ts.map +1 -1
  61. package/out/google/place-id.js.map +1 -1
  62. package/out/{google/index.d.ts → google.d.ts} +1 -1
  63. package/out/google.d.ts.map +1 -0
  64. package/out/{google/index.js → google.js} +1 -1
  65. package/out/google.js.map +1 -0
  66. package/out/h3/cell.d.ts +19 -73
  67. package/out/h3/cell.d.ts.map +1 -1
  68. package/out/h3/cell.js +20 -63
  69. package/out/h3/cell.js.map +1 -1
  70. package/out/h3/coverage.d.ts +11 -7
  71. package/out/h3/coverage.d.ts.map +1 -1
  72. package/out/h3/coverage.js +11 -7
  73. package/out/h3/coverage.js.map +1 -1
  74. package/out/h3/interior-cells.d.ts +9 -28
  75. package/out/h3/interior-cells.d.ts.map +1 -1
  76. package/out/h3/interior-cells.js +13 -32
  77. package/out/h3/interior-cells.js.map +1 -1
  78. package/out/h3/polygon-cells.d.ts +28 -120
  79. package/out/h3/polygon-cells.d.ts.map +1 -1
  80. package/out/h3/polygon-cells.js +48 -146
  81. package/out/h3/polygon-cells.js.map +1 -1
  82. package/out/{h3/index.d.ts → h3.d.ts} +2 -2
  83. package/out/h3.d.ts.map +1 -0
  84. package/out/{h3/index.js → h3.js} +2 -2
  85. package/out/h3.js.map +1 -0
  86. package/out/index.d.ts +6 -6
  87. package/out/index.d.ts.map +1 -1
  88. package/out/index.js +6 -6
  89. package/out/index.js.map +1 -1
  90. package/out/objects.d.ts +6 -6
  91. package/out/objects.d.ts.map +1 -1
  92. package/out/open-location-code.d.ts +11 -22
  93. package/out/open-location-code.d.ts.map +1 -1
  94. package/out/open-location-code.js +9 -40
  95. package/out/open-location-code.js.map +1 -1
  96. package/out/osgb36.d.ts +21 -97
  97. package/out/osgb36.d.ts.map +1 -1
  98. package/out/osgb36.js +12 -165
  99. package/out/osgb36.js.map +1 -1
  100. package/out/polyline.d.ts +5 -3
  101. package/out/polyline.d.ts.map +1 -1
  102. package/out/polyline.js +5 -3
  103. package/out/polyline.js.map +1 -1
  104. package/out/position.d.ts +17 -3
  105. package/out/position.d.ts.map +1 -1
  106. package/out/position.js +2 -2
  107. package/out/position.js.map +1 -1
  108. package/out/projection/transform.d.ts +70 -0
  109. package/out/projection/transform.d.ts.map +1 -0
  110. package/out/{projection-transform.js → projection/transform.js} +15 -17
  111. package/out/projection/transform.js.map +1 -0
  112. package/out/projection.d.ts +1 -1
  113. package/out/projection.d.ts.map +1 -1
  114. package/out/projection.js +1 -1
  115. package/out/regions/codes.d.ts.map +1 -1
  116. package/out/{regions/index.js → regions.d.ts} +1 -1
  117. package/out/regions.d.ts.map +1 -0
  118. package/out/{regions/index.d.ts → regions.js} +1 -1
  119. package/out/regions.js.map +1 -0
  120. package/out/tools/ogr/stream.d.ts +44 -0
  121. package/out/tools/ogr/stream.d.ts.map +1 -0
  122. package/out/tools/{ogr-stream.js → ogr/stream.js} +17 -10
  123. package/out/tools/ogr/stream.js.map +1 -0
  124. package/out/tools/ogr.d.ts +13 -10
  125. package/out/tools/ogr.d.ts.map +1 -1
  126. package/out/tools/ogr.js +18 -14
  127. package/out/tools/ogr.js.map +1 -1
  128. package/out/tools/tsconfig.tsbuildinfo +1 -0
  129. package/out/tsconfig.test.tsbuildinfo +1 -1
  130. package/out/well-known-text.d.ts +8 -8
  131. package/out/well-known-text.js +7 -7
  132. package/package.json +35 -127
  133. package/{lib/tools/ogr-stream.ts → tools/ogr/stream.ts} +25 -14
  134. package/{lib/tools → tools}/ogr.ts +26 -20
  135. package/lib/projection-transform.ts +0 -115
  136. package/out/coordinate-bounds.d.ts.map +0 -1
  137. package/out/coordinate-bounds.js.map +0 -1
  138. package/out/coordinate-formats.d.ts.map +0 -1
  139. package/out/coordinate-formats.js.map +0 -1
  140. package/out/geometries/index.d.ts.map +0 -1
  141. package/out/geometries/index.js.map +0 -1
  142. package/out/google/index.d.ts.map +0 -1
  143. package/out/google/index.js.map +0 -1
  144. package/out/h3/index.d.ts.map +0 -1
  145. package/out/h3/index.js.map +0 -1
  146. package/out/projection-transform.d.ts +0 -67
  147. package/out/projection-transform.d.ts.map +0 -1
  148. package/out/projection-transform.js.map +0 -1
  149. package/out/regions/index.d.ts.map +0 -1
  150. package/out/regions/index.js.map +0 -1
  151. package/out/tools/ogr-stream.d.ts +0 -34
  152. package/out/tools/ogr-stream.d.ts.map +0 -1
  153. package/out/tools/ogr-stream.js.map +0 -1
  154. /package/lib/{geometries/index.ts → geometries.ts} +0 -0
  155. /package/lib/{google/index.ts → google.ts} +0 -0
  156. /package/lib/{regions/index.ts → regions.ts} +0 -0
package/out/osgb36.js CHANGED
@@ -2,175 +2,34 @@
2
2
  * @copyright Sister Software.
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- *
6
- * OSGB36 / British National Grid (EPSG:27700) → WGS84 (EPSG:4326).
7
- *
8
- * Ordnance Survey ships its open products in eastings/northings on the National Grid, not in
9
- * degrees — Code-Point Open, OS Open UPRN, OS Open Names all do. Nothing else in the repo speaks
10
- * that coordinate system, so this module is the one place that converts it, and it lives in
11
- * `@mailwoman/spatial` because that is the math home (`projection.ts` names the datums; this file
12
- * moves between two of them).
13
- *
14
- * Two steps, both from OS's own "A Guide to Coordinate Systems in Great Britain":
15
- *
16
- * 1. **Inverse transverse Mercator (Redfearn's series)** — National Grid E/N → OSGB36 geodetic
17
- * lat/lon on the Airy 1830 ellipsoid. This step is EXACT to well below a millimetre; it is
18
- * plain map-projection algebra with no empirical content, and {@link osgb36GridToAiryLatLon}
19
- * reproduces the guide's Annexe C.2 worked example to **1.3e-5 arc-seconds (~0.4 mm)**, which
20
- * is that example's own published rounding rather than our error.
21
- * 2. **Seven-parameter Helmert** — Airy-1830 geodetic → geocentric cartesian → rotate/scale/shift
22
- * → WGS84 (GRS80) geodetic. This step is APPROXIMATE, and that is the whole accuracy story
23
- * below. Against the guide's own Annexe D Helmert worked example — which uses this same
24
- * transform, so it tests the implementation and not the approximation — the round trip lands
25
- * **8.4 mm** out, i.e. the published DMS rounding plus the ignored ellipsoidal height.
26
- *
27
- * ## Accuracy: ±5 m, measured, and why we accept it
28
- *
29
- * OSGB36 is a 1936 theodolite triangulation, not a geocentric datum. Its distortions relative to
30
- * WGS84 are irregular across GB — a couple of metres of local warp that no rigid-body transform can
31
- * absorb. OS's exact answer is **OSTN15**, a published ~1.5 MB grid of per-cell E/N shifts; the
32
- * seven-parameter Helmert implemented here is OS's own documented approximation to it, which the
33
- * guide rates at "up to 3.5 m (95%)".
34
- *
35
- * MEASURED against OS's official 40-point OSTN15/OSGM15 test set (`OSTN15_OSGM15_TestInput_*`, the
36
- * developer-pack vectors, joining each point's published OSGB36 E/N to its published ETRS89 lat/lon):
37
- *
38
- * | p50 | p90 | p95 | max | mean |
39
- * | ------ | ------ | ------ | ------ | ------ |
40
- * | 1.74 m | 3.23 m | 4.18 m | 4.91 m | 1.94 m |
41
- *
42
- * All 40 land under 5 m. The worst are exactly where OS warns the datum thins out — TP31 St Kilda
43
- * (4.91 m), TP01 Scilly (4.72 m), TP32 Outer Hebrides (4.18 m); the mainland points sit near 1–2 m.
44
- * p95 runs a little above the guide's 3.5 m because we discard ellipsoidal height (see
45
- * {@link osgb36AiryToWGS84}), and because two of the three worst points are offshore rocks where
46
- * "OSGB36 does not exist" in OS's own words.
47
- *
48
- * We take that error deliberately, because of what the coordinates are FOR. A Code-Point Open
49
- * centroid is the mean position of a postcode unit's delivery points snapped to the nearest real
50
- * address — the unit itself spans tens to hundreds of metres, and the resolver uses the centroid to
51
- * pick a locality and rank candidates within a few hundred metres. A 2 m datum error is one to two
52
- * orders of magnitude below the quantity being represented. Nothing downstream reads a postcode
53
- * centroid at metre precision.
54
- *
55
- * **Do not use this module for anything that does.** Surveying, cadastral work, or any consumer
56
- * comparing our coordinates against another OSGB36-derived dataset at sub-10 m tolerance needs
57
- * OSTN15, which means shipping the shift grid. If that day comes, the swap point is
58
- * {@link osgb36AiryToWGS84} — swap the Helmert for a grid interpolation and the projection step
59
- * above it is unchanged.
60
- *
61
- * @see https://www.ordnancesurvey.co.uk/documents/resources/guide-coordinate-systems-great-britain.pdf
62
- */
63
- /**
64
- * Semi-major axis of the Airy 1830 ellipsoid, in metres — the figure of the Earth OSGB36 is referenced to.
65
5
  */
66
6
  const AIRY_1830_A = 6_377_563.396;
67
- /**
68
- * Semi-minor axis of the Airy 1830 ellipsoid, in metres.
69
- */
70
7
  const AIRY_1830_B = 6_356_256.909;
71
- /**
72
- * Semi-major axis of the GRS80 ellipsoid, in metres. WGS84's own semi-major axis is identical; the two ellipsoids
73
- * differ only in the flattening's last digits (~0.1 mm at the pole), far below this module's error budget.
74
- */
75
8
  const GRS80_A = 6_378_137;
76
- /**
77
- * Semi-minor axis of the GRS80 ellipsoid, in metres.
78
- */
79
9
  const GRS80_B = 6_356_752.3141;
80
- /**
81
- * Scale factor on the National Grid's central meridian.
82
- */
83
10
  const NATIONAL_GRID_F0 = 0.9996012717;
84
- /**
85
- * Latitude of the National Grid's true origin, 49° N, in radians.
86
- */
87
11
  const NATIONAL_GRID_LAT0 = (49 * Math.PI) / 180;
88
- /**
89
- * Longitude of the National Grid's true origin, 2° W, in radians.
90
- */
91
12
  const NATIONAL_GRID_LON0 = (-2 * Math.PI) / 180;
92
- /**
93
- * Easting of the National Grid's true origin (the "false easting"), in metres.
94
- */
95
13
  const NATIONAL_GRID_E0 = 400_000;
96
- /**
97
- * Northing of the National Grid's true origin (the "false northing"), in metres. Negative because the true origin sits
98
- * south-west of the grid's own zero.
99
- */
100
14
  const NATIONAL_GRID_N0 = -100_000;
101
- /**
102
- * Arc-seconds → radians. The Helmert rotations are published in arc-seconds.
103
- */
104
15
  const ARCSEC_TO_RAD = Math.PI / (180 * 3600);
105
- /**
106
- * Parts-per-million → unitless scale. The Helmert scale factor is published in ppm.
107
- */
108
16
  const PPM = 1e-6;
109
- /**
110
- * Convergence threshold for the meridional-arc iteration in {@link osgb36GridToAiryLatLon}, in METRES of northing. OS's
111
- * guide specifies 0.01 mm; this is that figure. It bounds the northing residual, not the latitude, which is why it is
112
- * expressed in metres and compared against `northing - N0 - M`.
113
- */
114
17
  const MERIDIONAL_ARC_TOLERANCE_M = 1e-5;
115
- /**
116
- * Convergence threshold for the cartesian→geodetic latitude iteration in {@link osgb36AiryToWGS84}, in RADIANS. 1e-13
117
- * rad is ~0.6 µm on the ground — far below anything this module claims, and reached in four or five passes at GB
118
- * latitudes.
119
- */
120
18
  const GEODETIC_LATITUDE_TOLERANCE_RAD = 1e-13;
121
- /**
122
- * The seven-parameter Helmert transformation taking OSGB36 (Airy 1830) geocentric cartesian coordinates to WGS84.
123
- *
124
- * OS publishes this transform in the ETRS89/WGS84 → OSGB36 direction (guide table 4), as `tx = -446.448, ty = +125.157,
125
- * tz = -542.060, s = +20.4894 ppm, rx = -0.1502", ry = -0.2470", rz = -0.8421"`. We need the OTHER direction, so every
126
- * parameter is negated — valid to well inside the transform's own metre-scale error because the rotations are
127
- * microradian-scale and the second-order terms of a proper inversion are sub-millimetre.
128
- *
129
- * The rotation convention is **Position Vector** (EPSG method 1033), NOT Coordinate Frame Rotation (EPSG 1032). The two
130
- * differ only in the sign of the three rotations, which is why citing the method code matters more than it looks: paste
131
- * these numbers into a library expecting 1032 and every result moves by roughly 20 m with no error raised.
132
- *
133
- * Getting a sign wrong here does not produce a subtly worse answer; it produces a coordinate tens to hundreds of metres
134
- * out, in a consistent direction — which reads as a plausible coordinate. That is what the Annexe D test is for.
135
- */
136
19
  const OSGB36_TO_WGS84_HELMERT = {
137
- /**
138
- * X translation, metres.
139
- */
140
20
  tx: 446.448,
141
- /**
142
- * Y translation, metres.
143
- */
144
21
  ty: -125.157,
145
- /**
146
- * Z translation, metres.
147
- */
148
22
  tz: 542.06,
149
- /**
150
- * Scale correction, parts per million.
151
- */
152
23
  scalePPM: -20.4894,
153
- /**
154
- * Rotation about the X axis, arc-seconds.
155
- */
156
24
  rx: 0.1502,
157
- /**
158
- * Rotation about the Y axis, arc-seconds.
159
- */
160
25
  ry: 0.247,
161
- /**
162
- * Rotation about the Z axis, arc-seconds.
163
- */
164
26
  rz: 0.8421,
165
27
  };
166
28
  /**
167
- * Convert National Grid eastings/northings to OSGB36 geodetic lat/lon on the Airy 1830 ellipsoid, by Redfearn's inverse
168
- * transverse Mercator series.
29
+ * Converts a National Grid easting and northing to OSGB36 latitude and longitude
30
+ * on the Airy 1830 ellipsoid, without a datum shift.
169
31
  *
170
- * This is the EXACT half of the pipeline — pure projection algebra, no datum shift. The result is still on Airy 1830,
171
- * so it is NOT a WGS84 coordinate and must not be handed to anything expecting one; feed it to
172
- * {@link osgb36AiryToWGS84}. Exported separately so the projection can be tested against OS's worked example
173
- * independently of the Helmert, which is the only way to tell a projection bug from a datum-shift bug.
32
+ * Pass the result to {@link osgb36AiryToWGS84} to get WGS84 coordinates.
174
33
  */
175
34
  export function osgb36GridToAiryLatLon({ easting, northing }) {
176
35
  const a = AIRY_1830_A;
@@ -180,13 +39,10 @@ export function osgb36GridToAiryLatLon({ easting, northing }) {
180
39
  const lon0 = NATIONAL_GRID_LON0;
181
40
  const e0 = NATIONAL_GRID_E0;
182
41
  const n0 = NATIONAL_GRID_N0;
183
- // Eccentricity squared of the Airy ellipsoid, and the `n` series parameter.
184
42
  const e2 = (a * a - b * b) / (a * a);
185
43
  const n = (a - b) / (a + b);
186
44
  const n2 = n * n;
187
45
  const n3 = n2 * n;
188
- // Iterate latitude until the meridional arc `M` matches the northing. OS's guide specifies a 0.01 mm
189
- // threshold; it converges in three or four passes anywhere in GB.
190
46
  let lat = lat0;
191
47
  let m = 0;
192
48
  do {
@@ -207,7 +63,6 @@ export function osgb36GridToAiryLatLon({ easting, northing }) {
207
63
  const tan2 = tanLat * tanLat;
208
64
  const tan4 = tan2 * tan2;
209
65
  const tan6 = tan4 * tan2;
210
- // `nu` = transverse radius of curvature; `rho` = meridional radius; `eta2` = their ratio less one.
211
66
  const nu = a * f0 * (1 - e2 * sinLat * sinLat) ** -0.5;
212
67
  const rho = a * f0 * (1 - e2) * (1 - e2 * sinLat * sinLat) ** -1.5;
213
68
  const eta2 = nu / rho - 1;
@@ -234,16 +89,13 @@ export function osgb36GridToAiryLatLon({ easting, northing }) {
234
89
  };
235
90
  }
236
91
  /**
237
- * Convert OSGB36 geodetic lat/lon (Airy 1830) to WGS84 lat/lon (GRS80) via the seven-parameter Helmert.
92
+ * Converts OSGB36 latitude and longitude on Airy 1830 to WGS84 with the seven-parameter
93
+ * Helmert transform, accurate to about 5 m.
238
94
  *
239
- * This is the APPROXIMATE half — see the module docstring for the ±5 m budget and when it stops being acceptable.
240
- * Heights are not modelled: the input is treated as sitting on the Airy ellipsoid and the output's ellipsoidal height
241
- * is discarded. For a horizontal postcode centroid that costs well under a metre; for anything vertical it is wrong by
242
- * the ~50 m geoid–ellipsoid separation over GB, so this function does not pretend to return a height.
95
+ * The transform ignores height, so use the result for horizontal positions only.
243
96
  */
244
97
  export function osgb36AiryToWGS84({ latitude, longitude }) {
245
98
  const { tx, ty, tz, scalePPM, rx, ry, rz } = OSGB36_TO_WGS84_HELMERT;
246
- // --- Airy 1830 geodetic → geocentric cartesian.
247
99
  const phi = (latitude * Math.PI) / 180;
248
100
  const lambda = (longitude * Math.PI) / 180;
249
101
  const sinPhi = Math.sin(phi);
@@ -253,7 +105,6 @@ export function osgb36AiryToWGS84({ latitude, longitude }) {
253
105
  const x1 = nuAiry * cosPhi * Math.cos(lambda);
254
106
  const y1 = nuAiry * cosPhi * Math.sin(lambda);
255
107
  const z1 = (1 - e2Airy) * nuAiry * sinPhi;
256
- // --- Helmert: rotate, scale, translate.
257
108
  const s = 1 + scalePPM * PPM;
258
109
  const rxRad = rx * ARCSEC_TO_RAD;
259
110
  const ryRad = ry * ARCSEC_TO_RAD;
@@ -261,12 +112,10 @@ export function osgb36AiryToWGS84({ latitude, longitude }) {
261
112
  const x2 = tx + s * x1 - rzRad * y1 + ryRad * z1;
262
113
  const y2 = ty + rzRad * x1 + s * y1 - rxRad * z1;
263
114
  const z2 = tz - ryRad * x1 + rxRad * y1 + s * z1;
264
- // --- GRS80 geocentric cartesian → geodetic, by the standard iteration on latitude.
265
115
  const e2GRS = (GRS80_A * GRS80_A - GRS80_B * GRS80_B) / (GRS80_A * GRS80_A);
266
116
  const p = Math.sqrt(x2 * x2 + y2 * y2);
267
117
  let phi2 = Math.atan2(z2, p * (1 - e2GRS));
268
118
  let phiPrev = 2 * Math.PI;
269
- // Converges in a handful of passes at GB latitudes; the guard bounds it regardless.
270
119
  for (let i = 0; i < 100 && Math.abs(phi2 - phiPrev) > GEODETIC_LATITUDE_TOLERANCE_RAD; i++) {
271
120
  phiPrev = phi2;
272
121
  const nuGRS = GRS80_A / Math.sqrt(1 - e2GRS * Math.sin(phi2) * Math.sin(phi2));
@@ -279,20 +128,18 @@ export function osgb36AiryToWGS84({ latitude, longitude }) {
279
128
  };
280
129
  }
281
130
  /**
282
- * Convert a British National Grid (EPSG:27700) easting/northing straight to WGS84 (EPSG:4326) lat/lon — the composition
283
- * of {@link osgb36GridToAiryLatLon} and {@link osgb36AiryToWGS84}, and the function callers actually want.
131
+ * Converts a British National Grid (EPSG:27700) easting and northing to WGS84
132
+ * (EPSG:4326) latitude and longitude, accurate to about 5 m across GB.
284
133
  *
285
- * Accurate to about ±5 m across GB (see the module docstring). Does NOT validate that the input lies within the grid's
286
- * GB extent: `{easting: 0, northing: 0}` is a real point in the Atlantic south-west of the Scillies, and Code-Point
287
- * Open uses exactly that to mean "no coordinate available" (its 865 positional-quality-90 rows). Callers must filter
288
- * those rows themselves — a zero here is a legitimate coordinate, so this module cannot tell the difference.
134
+ * It converts `{ easting: 0, northing: 0 }` like any other point, so callers must
135
+ * filter out Code-Point Open's zero placeholder rows.
289
136
  */
290
137
  export function osgb36ToWGS84(point) {
291
138
  return osgb36AiryToWGS84(osgb36GridToAiryLatLon(point));
292
139
  }
293
140
  /**
294
- * {@link osgb36ToWGS84} in GeoJSON axis order — `[longitude, latitude]`, matching {@link Coordinates2D} and every
295
- * geometry helper in this package.
141
+ * Converts a National Grid point to WGS84 in GeoJSON `[longitude, latitude]` order,
142
+ * matching {@link Coordinates2D}.
296
143
  */
297
144
  export function osgb36ToCoordinates2D(point) {
298
145
  const { latitude, longitude } = osgb36ToWGS84(point);
package/out/osgb36.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"osgb36.js","sourceRoot":"","sources":["../lib/osgb36.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAIH;;GAEG;AACH,MAAM,WAAW,GAAG,aAAa,CAAA;AAEjC;;GAEG;AACH,MAAM,WAAW,GAAG,aAAa,CAAA;AAEjC;;;GAGG;AACH,MAAM,OAAO,GAAG,SAAS,CAAA;AAEzB;;GAEG;AACH,MAAM,OAAO,GAAG,cAAc,CAAA;AAE9B;;GAEG;AACH,MAAM,gBAAgB,GAAG,YAAY,CAAA;AAErC;;GAEG;AACH,MAAM,kBAAkB,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAA;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GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;QAC9E,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;QAEzC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;IACpE,CAAC;IAED,OAAO;QACN,QAAQ,EAAE,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE;QAChC,SAAS,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE;KAC/C,CAAA;AACF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAwB;IACrD,OAAO,iBAAiB,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAA;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAwB;IAC7D,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,CAAA;IAEpD,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;AAC7B,CAAC"}
package/out/polyline.d.ts CHANGED
@@ -14,14 +14,16 @@
14
14
  /**
15
15
  * Clamp a fraction into `[0, 1]`.
16
16
  *
17
- * NaN passes through, which is deliberate: an interpolation whose inputs were not numbers should produce NaN
18
- * coordinates a caller can detect, not silently snap to a segment's start.
17
+ * NaN passes through deliberately.
18
+ * An interpolation whose inputs were not numbers should produce NaN coordinates a
19
+ * caller can detect rather than silently snap to a segment's start.
19
20
  */
20
21
  export declare function clampFraction(t: number): number;
21
22
  /**
22
23
  * The point at fraction `t` of a polyline's total arc length (haversine), plus that total in km.
23
24
  *
24
- * `t` is assumed clamped to `[0, 1]`. A zero-length polyline yields its first vertex and a length of 0, so a degenerate
25
+ * `t` is assumed clamped to `[0, 1]`.
26
+ * A zero-length polyline yields its first vertex and a length of 0, so a degenerate
25
27
  * segment still produces a usable coordinate rather than NaN.
26
28
  */
27
29
  export declare function pointAlong(polyline: readonly [number, number][], t: number): [lon: number, lat: number, lengthKm: number];
@@ -1 +1 @@
1
- {"version":3,"file":"polyline.d.ts","sourceRoot":"","sources":["../lib/polyline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EACrC,CAAC,EAAE,MAAM,GACP,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAqC9C"}
1
+ {"version":3,"file":"polyline.d.ts","sourceRoot":"","sources":["../lib/polyline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EACrC,CAAC,EAAE,MAAM,GACP,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAqC9C"}
package/out/polyline.js CHANGED
@@ -15,8 +15,9 @@ import { haversineKm } from "#distance";
15
15
  /**
16
16
  * Clamp a fraction into `[0, 1]`.
17
17
  *
18
- * NaN passes through, which is deliberate: an interpolation whose inputs were not numbers should produce NaN
19
- * coordinates a caller can detect, not silently snap to a segment's start.
18
+ * NaN passes through deliberately.
19
+ * An interpolation whose inputs were not numbers should produce NaN coordinates a
20
+ * caller can detect rather than silently snap to a segment's start.
20
21
  */
21
22
  export function clampFraction(t) {
22
23
  return t < 0 ? 0 : Math.min(1, t);
@@ -24,7 +25,8 @@ export function clampFraction(t) {
24
25
  /**
25
26
  * The point at fraction `t` of a polyline's total arc length (haversine), plus that total in km.
26
27
  *
27
- * `t` is assumed clamped to `[0, 1]`. A zero-length polyline yields its first vertex and a length of 0, so a degenerate
28
+ * `t` is assumed clamped to `[0, 1]`.
29
+ * A zero-length polyline yields its first vertex and a length of 0, so a degenerate
28
30
  * segment still produces a usable coordinate rather than NaN.
29
31
  */
30
32
  export function pointAlong(polyline, t) {
@@ -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,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAE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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
@@ -6,12 +6,26 @@
6
6
  * This file contains types and utilities for working with geographic positions.
7
7
  */
8
8
  import type { LatLngLiteral } from "@googlemaps/google-maps-services-js";
9
- export { isValidLatitude, isValidLongitude } from "#coordinate-bounds";
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;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EvD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD"}
package/out/position.js CHANGED
@@ -5,8 +5,8 @@
5
5
  *
6
6
  * This file contains types and utilities for working with geographic positions.
7
7
  */
8
- import { isValidLatitude, isValidLongitude } from "#coordinate-bounds";
9
- export { isValidLatitude, isValidLongitude } from "#coordinate-bounds";
8
+ import { isValidLatitude, isValidLongitude } from "#coordinate/bounds";
9
+ export { isValidLatitude, isValidLongitude } from "#coordinate/bounds";
10
10
  /**
11
11
  * Arity of a `[lon, lat]` coordinate tuple.
12
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"position.js","sourceRoot":"","sources":["../lib/position.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAEtE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAEtE;;GAEG;AACH,MAAM,iBAAiB,GAAG,CAAC,CAAA;AAE3B;;GAEG;AACH,MAAM,mBAAmB,GAAG,CAAC,CAAA;AA6B7B;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAmB;IAC9E,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;AAC7B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAgB;IAC3E,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;AAC7B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,CAAC,MAAM,EAAE,MAAM,CAAmB;IACxE,MAAM,cAAc,GAAG,gBAAgB,CAAC,MAAM,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,CAAA;IAC1E,MAAM,aAAa,GAAG,eAAe,CAAC,MAAM,CAAC,IAAI,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KAAK,CAAA;IAErD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IAE9E,OAAO,IAAI,CAAA;AACZ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAc;IACvD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,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"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Ask PROJ which datum transformation it would choose. Refuse a ballpark operation.
7
+ *
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.
14
+ *
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.
18
+ *
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.
22
+ *
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.
27
+ */
28
+ /**
29
+ * Reports the operation PROJ would choose and whether it can run it.
30
+ */
31
+ export interface DatumTransformationVerdict {
32
+ /**
33
+ * The candidate operation string returned by PROJ, verbatim.
34
+ *
35
+ * Absent when PROJ returned no candidate operation.
36
+ */
37
+ best?: string;
38
+ usable: boolean;
39
+ reason: string;
40
+ }
41
+ /**
42
+ * Reads `projinfo --summary` output.
43
+ *
44
+ * It reports which operation PROJ would choose and whether it can run it.
45
+ */
46
+ export declare function assessDatumTransformation(summary: string): DatumTransformationVerdict;
47
+ /**
48
+ * The target every layer ingest reprojects to.
49
+ * H3 takes WGS84 latitude and longitude.
50
+ */
51
+ export declare const WGS84_EPSG = 4326;
52
+ export interface AssertDatumTransformationOptions {
53
+ /**
54
+ * Identifies the caller in the refusal, so a build log reports which ingest stopped.
55
+ */
56
+ context: string;
57
+ targetEPSG?: number;
58
+ /**
59
+ * The area-of-use to name in the `projsync` action the message prints.
60
+ */
61
+ areaOfUse?: string;
62
+ }
63
+ /**
64
+ * Refuse an ingest whose best available datum transformation is a ballpark one, or is missing its grid.
65
+ *
66
+ * @throws {Error} When proj names no candidate, would use a ballpark offset,
67
+ * or would use an operation whose grid is not installed.
68
+ */
69
+ export declare function assertDatumTransformationAvailable(sourceEPSG: number, options: AssertDatumTransformationOptions): Promise<DatumTransformationVerdict>;
70
+ //# sourceMappingURL=transform.d.ts.map
@@ -0,0 +1 @@
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
- //# sourceMappingURL=projection-transform.js.map
46
+ //# sourceMappingURL=transform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform.js","sourceRoot":"","sources":["../../lib/projection/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AA4C7C;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAe;IACxD,2EAA2E;IAC3E,6BAA6B;IAC7B,iFAAiF;IACjF,8BAA8B;IAC9B,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAC9C,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,CACtG,CAAA;IAED,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,uCAAuC,EAAE,CAAA;IAEpF,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,2BAA2B,EAAE,CAAA;IAEtG,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAA;IAE9G,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,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,7 +16,7 @@ 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
  };
@@ -1 +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;;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;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"}
package/out/projection.js CHANGED
@@ -16,7 +16,7 @@ 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
  };
@@ -1 +1 @@
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
+ {"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;iBAC9B,QAAQ;iBACR,YAAY;iBACZ,MAAM;iBACN,QAAQ;iBACR,eAAe;iBACf,SAAS;iBACT,eAAe;CAC+B,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"}