@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailwoman/spatial",
3
- "version": "10.0.0",
3
+ "version": "10.1.0",
4
4
  "description": "Spatial analysis, geocoding, and other geo-related utilities.",
5
5
  "keywords": [
6
6
  "geo",
@@ -20,20 +20,21 @@
20
20
  },
21
21
  "files": [
22
22
  "out/",
23
- "*.ts",
24
- "*.tsx",
25
- "**/*.ts",
26
- "**/*.tsx",
27
- "!*.test.ts",
28
- "!*.test.tsx",
23
+ "lib/**/*.ts",
24
+ "lib/**/*.tsx",
25
+ "tools/**/*.ts",
29
26
  "!**/*.test.ts",
30
27
  "!**/*.test.tsx",
31
- "!__snapshots__/",
32
- "!test/**"
28
+ "!__snapshots__/"
33
29
  ],
34
30
  "type": "module",
35
31
  "sideEffects": false,
36
32
  "imports": {
33
+ "#tools/*": {
34
+ "types": "./out/tools/*.d.ts",
35
+ "node": "./out/tools/*.js",
36
+ "default": "./out/tools/*.js"
37
+ },
37
38
  "#*": {
38
39
  "types": "./out/*.d.ts",
39
40
  "node": "./out/*.js",
@@ -42,143 +43,48 @@
42
43
  },
43
44
  "exports": {
44
45
  "./package.json": "./package.json",
45
- "./coordinate-bounds": {
46
- "types": "./out/coordinate/bounds.d.ts",
47
- "node": "./out/coordinate/bounds.js",
48
- "default": "./out/coordinate/bounds.js"
49
- },
50
46
  ".": {
51
47
  "types": "./out/index.d.ts",
52
48
  "node": "./out/index.js",
53
49
  "default": "./out/index.js"
54
50
  },
55
- "./coordinate-formats": {
56
- "types": "./out/coordinate/formats.d.ts",
57
- "node": "./out/coordinate/formats.js",
58
- "default": "./out/coordinate/formats.js"
59
- },
60
- "./open-location-code": {
61
- "types": "./out/open-location-code.d.ts",
62
- "node": "./out/open-location-code.js",
63
- "default": "./out/open-location-code.js"
64
- },
65
- "./geometries/polygon": {
66
- "types": "./out/geometries/polygon.d.ts",
67
- "node": "./out/geometries/polygon.js",
68
- "default": "./out/geometries/polygon.js"
69
- },
70
- "./h3/cell": {
71
- "types": "./out/h3/cell.d.ts",
72
- "node": "./out/h3/cell.js",
73
- "default": "./out/h3/cell.js"
74
- },
75
- "./h3/polygon-cells": {
76
- "types": "./out/h3/polygon-cells.d.ts",
77
- "node": "./out/h3/polygon-cells.js",
78
- "default": "./out/h3/polygon-cells.js"
79
- },
80
- "./geometries/ring-blob": {
81
- "types": "./out/geometries/ring-blob.d.ts",
82
- "node": "./out/geometries/ring-blob.js",
83
- "default": "./out/geometries/ring-blob.js"
51
+ "./tools/*": {
52
+ "types": "./out/tools/*.d.ts",
53
+ "node": "./out/tools/*.js",
54
+ "default": "./out/tools/*.js"
84
55
  },
85
- "./projection-transform": {
86
- "types": "./out/projection/transform.d.ts",
87
- "node": "./out/projection/transform.js",
88
- "default": "./out/projection/transform.js"
89
- },
90
- "./well-known-text": {
91
- "types": "./out/well-known-text.d.ts",
92
- "node": "./out/well-known-text.js",
93
- "default": "./out/well-known-text.js"
94
- },
95
- "./tools/ogr": {
96
- "types": "./out/tools/ogr/index.d.ts",
97
- "node": "./out/tools/ogr/index.js",
98
- "default": "./out/tools/ogr/index.js"
99
- },
100
- "./h3/coverage": {
101
- "types": "./out/h3/coverage.d.ts",
102
- "node": "./out/h3/coverage.js",
103
- "default": "./out/h3/coverage.js"
104
- },
105
- "./tools/ogr-stream": {
106
- "types": "./out/tools/ogr/stream.d.ts",
107
- "node": "./out/tools/ogr/stream.js",
108
- "default": "./out/tools/ogr/stream.js"
56
+ "./*": {
57
+ "types": "./out/*.d.ts",
58
+ "node": "./out/*.js",
59
+ "default": "./out/*.js"
109
60
  }
110
61
  },
111
62
  "publishConfig": {
112
63
  "access": "public",
113
64
  "exports": {
114
65
  "./package.json": "./package.json",
115
- "./coordinate-bounds": {
116
- "types": "./out/coordinate/bounds.d.ts",
117
- "node": "./out/coordinate/bounds.js",
118
- "default": "./out/coordinate/bounds.js"
119
- },
120
66
  ".": {
121
67
  "types": "./out/index.d.ts",
122
68
  "node": "./out/index.js",
123
69
  "default": "./out/index.js"
124
70
  },
125
- "./coordinate-formats": {
126
- "types": "./out/coordinate/formats.d.ts",
127
- "node": "./out/coordinate/formats.js",
128
- "default": "./out/coordinate/formats.js"
129
- },
130
- "./open-location-code": {
131
- "types": "./out/open-location-code.d.ts",
132
- "node": "./out/open-location-code.js",
133
- "default": "./out/open-location-code.js"
134
- },
135
- "./geometries/polygon": {
136
- "types": "./out/geometries/polygon.d.ts",
137
- "node": "./out/geometries/polygon.js",
138
- "default": "./out/geometries/polygon.js"
139
- },
140
- "./h3/cell": {
141
- "types": "./out/h3/cell.d.ts",
142
- "node": "./out/h3/cell.js",
143
- "default": "./out/h3/cell.js"
144
- },
145
- "./h3/polygon-cells": {
146
- "types": "./out/h3/polygon-cells.d.ts",
147
- "node": "./out/h3/polygon-cells.js",
148
- "default": "./out/h3/polygon-cells.js"
149
- },
150
- "./geometries/ring-blob": {
151
- "types": "./out/geometries/ring-blob.d.ts",
152
- "node": "./out/geometries/ring-blob.js",
153
- "default": "./out/geometries/ring-blob.js"
154
- },
155
- "./projection-transform": {
156
- "types": "./out/projection/transform.d.ts",
157
- "node": "./out/projection/transform.js",
158
- "default": "./out/projection/transform.js"
71
+ "./tools/*": {
72
+ "types": "./out/tools/*.d.ts",
73
+ "node": "./out/tools/*.js",
74
+ "default": "./out/tools/*.js"
159
75
  },
160
- "./well-known-text": {
161
- "types": "./out/well-known-text.d.ts",
162
- "node": "./out/well-known-text.js",
163
- "default": "./out/well-known-text.js"
164
- },
165
- "./tools/ogr": {
166
- "types": "./out/tools/ogr/index.d.ts",
167
- "node": "./out/tools/ogr/index.js",
168
- "default": "./out/tools/ogr/index.js"
169
- },
170
- "./h3/coverage": {
171
- "types": "./out/h3/coverage.d.ts",
172
- "node": "./out/h3/coverage.js",
173
- "default": "./out/h3/coverage.js"
174
- },
175
- "./tools/ogr-stream": {
176
- "types": "./out/tools/ogr/stream.d.ts",
177
- "node": "./out/tools/ogr/stream.js",
178
- "default": "./out/tools/ogr/stream.js"
76
+ "./*": {
77
+ "types": "./out/*.d.ts",
78
+ "node": "./out/*.js",
79
+ "default": "./out/*.js"
179
80
  }
180
81
  },
181
82
  "imports": {
83
+ "#tools/*": {
84
+ "types": "./out/tools/*.d.ts",
85
+ "node": "./out/tools/*.js",
86
+ "default": "./out/tools/*.js"
87
+ },
182
88
  "#*": {
183
89
  "types": "./out/*.d.ts",
184
90
  "node": "./out/*.js",
@@ -187,14 +93,16 @@
187
93
  }
188
94
  },
189
95
  "dependencies": {
190
- "@mailwoman/core": "10.0.0",
96
+ "@mailwoman/core": "10.1.0",
191
97
  "geo-coordinates-parser": "^1.7.4",
192
98
  "h3-js": "^4.5.0",
99
+ "path-ts": "^2.5.0",
100
+ "spliterator": "^8.1.0",
193
101
  "wkx": "^0.5.0"
194
102
  },
195
103
  "devDependencies": {
196
104
  "@googlemaps/google-maps-services-js": "^3.4.2",
197
- "@mailwoman/annotations": "10.0.0",
105
+ "@mailwoman/annotations": "10.1.0",
198
106
  "type-fest": "^5.9.0"
199
107
  },
200
108
  "optionalDependencies": {
@@ -7,6 +7,7 @@
7
7
 
8
8
  import { tryParsingJSON } from "@mailwoman/core/json"
9
9
  import { spawnProcess } from "@mailwoman/core/process"
10
+ import type { PathBuilderLike } from "path-ts"
10
11
  import { TextSpliterator } from "spliterator"
11
12
 
12
13
  const RECORD_SEPARATOR = 0x1e
@@ -15,9 +16,12 @@ const STDERR_TAIL_CHARS = 800
15
16
  export interface OGRProcess {
16
17
  stdout: NodeJS.ReadableStream
17
18
  /**
18
- * Resolves on a clean exit; rejects with the exit code and the stderr tail otherwise. A truncated stream reads as a
19
- * short but well-formed feature list, which is exactly the partial result that must throw rather than be reported as
20
- * a smaller extract — so consume the stream fully, then await this.
19
+ * Resolves on a clean exit.
20
+ * Rejects with the exit code and the stderr tail otherwise.
21
+ *
22
+ * A truncated stream can look like a shorter, valid feature list.
23
+ * That partial result must raise an error instead of looking like a smaller extract.
24
+ * Consume the stream fully, then await this promise.
21
25
  */
22
26
  settled: Promise<void>
23
27
  /**
@@ -27,10 +31,12 @@ export interface OGRProcess {
27
31
  }
28
32
 
29
33
  /**
30
- * Spawn `ogr2ogr` with stderr accumulated for the failure message. The caller owns the stdout format (GeoJSONSeq, CSV,
31
- * …) and its parsing; {@link ogr2ogrGeoJSONSeq} is the GeoJSONSeq reading over this.
34
+ * Spawn `ogr2ogr` with stderr accumulated for the failure message.
35
+ *
36
+ * The caller owns the stdout format (GeoJSONSeq, CSV, …) and its parsing;
37
+ * {@link ogr2ogrGeoJSONSeq} is the GeoJSONSeq reading over this.
32
38
  */
33
- export function spawnOGR2OGR(args: readonly string[], context: string): OGRProcess {
39
+ export function spawnOGR2OGR(args: readonly PathBuilderLike[], context: string): OGRProcess {
34
40
  const child = spawnProcess("ogr2ogr", [...args], { stdio: ["ignore", "pipe", "pipe"] })
35
41
  let stderr = ""
36
42
 
@@ -52,9 +58,10 @@ export function spawnOGR2OGR(args: readonly string[], context: string): OGRProce
52
58
  })
53
59
  })
54
60
 
55
- // A failed spawn rejects `settled` BEFORE any consumer awaits it — the consumer is still draining the stream on a
56
- // later tick, and a consumer that abandons the stream never awaits it at all — so an unobserved rejection would trip
57
- // the process's unhandled-rejection hook. Observed at birth instead; every consumer still awaits the real verdict.
61
+ // A failed spawn can reject `settled` before a consumer awaits it.
62
+ // A consumer may still be draining stdout on a later tick or may abandon the stream.
63
+ // Attach a handler at birth to prevent an unhandled-rejection event.
64
+ // Every consumer still awaits the real verdict.
58
65
  settled.catch(() => undefined)
59
66
 
60
67
  return {
@@ -71,12 +78,16 @@ export function spawnOGR2OGR(args: readonly string[], context: string): OGRProce
71
78
  /**
72
79
  * Stream a GeoJSONSeq extraction as parsed features.
73
80
  *
74
- * Strips the RFC-8142 record separator (U+001E) GDAL MAY prefix records with — `.trim()` does not remove it (not
75
- * whitespace), so an RS-framed record would fail to parse and be silently skipped, all of them, and an empty extract
76
- * would read as a real absence. A malformed record is tolerated (skipped) rather than thrown; a non-zero exit throws
77
- * after the stream drains.
81
+ * Strips the RFC-8142 record separator (U+001E) gdal may prefix records with.
82
+ * `.trim()` leaves U+001E intact.
83
+ *
84
+ * The parser strips it first because `tryParsingJSON` would otherwise skip each RS-prefixed record.
85
+ * If the code skipped every record, an empty extract would look like a real absence.
86
+ *
87
+ * A malformed record is tolerated (skipped) rather than thrown.
88
+ * A non-zero exit throws after the stream drains.
78
89
  */
79
- export async function* ogr2ogrGeoJSONSeq<T>(args: readonly string[], context: string): AsyncGenerator<T> {
90
+ export async function* ogr2ogrGeoJSONSeq<T>(args: readonly PathBuilderLike[], context: string): AsyncGenerator<T> {
80
91
  const proc = spawnOGR2OGR(args, context)
81
92
 
82
93
  try {
@@ -6,14 +6,14 @@
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
15
 
16
- import { parseJSONStrict } from "@mailwoman/core/json"
16
+ import { parseJSONStrict, stringifyJSON } from "@mailwoman/core/json"
17
17
  import { runFile } from "@mailwoman/core/process"
18
18
 
19
19
  import { assertDatumTransformationAvailable } from "#projection/transform"
@@ -41,13 +41,15 @@ export interface ReadOGRLayerIdentityOptions {
41
41
  */
42
42
  path: string
43
43
  /**
44
- * Layer inside it, asserted against what the source answers. Omitted, the source's first layer answers and only its
45
- * presence is checked.
44
+ * Layer inside it, asserted against what the source answers.
45
+ *
46
+ * Omitted, the source's first layer answers and only its presence is checked.
46
47
  */
47
48
  layer?: string
48
49
  /**
49
- * The EPSG code the source must declare. A source declaring anything else is a product change, not a variation to
50
- * absorb.
50
+ * The epsg code the source must declare.
51
+ *
52
+ * A source declaring anything else is a product change rather than a variation to absorb.
51
53
  */
52
54
  expectEPSG: number
53
55
  /**
@@ -71,11 +73,11 @@ export interface ReadOGRLayerIdentityOptions {
71
73
  */
72
74
  messages?: {
73
75
  /**
74
- * After `declares no EPSG authority code — `.
76
+ * After `declares no epsg authority code — `.
75
77
  */
76
78
  noAuthorityCode?: string
77
79
  /**
78
- * After `expected EPSG:<code> — `.
80
+ * After `expected epsg:<code> — `.
79
81
  */
80
82
  epsgMismatch?: string
81
83
  /**
@@ -86,21 +88,25 @@ export interface ReadOGRLayerIdentityOptions {
86
88
  }
87
89
 
88
90
  /**
89
- * A summary is small; the ceiling only guards against a pathological driver.
91
+ * A summary is small.
92
+ * The ceiling only guards against a pathological driver.
90
93
  */
91
94
  const OGRINFO_MAX_BUFFER = 32 * 1024 * 1024
92
95
 
93
96
  /**
94
- * Ordinates in a 2D extent: `minLon, minLat, maxLon, maxLat`. A shorter array is a 3D or degenerate extent this reader
95
- * does not understand, not a 2D one with something missing.
97
+ * Ordinates in a 2D extent: `minLon, minLat, maxLon, maxLat`.
98
+ *
99
+ * A shorter array is a 3D or degenerate extent this reader does not understand
100
+ * rather than a 2D one with something missing.
96
101
  */
97
102
  const EXTENT_ORDINATES = 4
98
103
 
99
104
  /**
100
- * Read what the source declares about itself, and refuse a projection the calling ingest was not written for.
105
+ * Read what the source declares about itself.
106
+ * Refuse a projection the calling ingest was not written for.
101
107
  *
102
- * @throws {Error} When the layer is missing, declares no EPSG authority code, declares one other than `expectEPSG`,
103
- * reports no feature count, or fails a `requireExtent`/`requireFields` condition.
108
+ * @throws {Error} When the layer is missing, declares no epsg authority code, declares one other than
109
+ * `expectEPSG`, reports no feature count, or fails a `requireExtent`/`requireFields` condition.
104
110
  */
105
111
  export async function readOGRLayerIdentity(options: ReadOGRLayerIdentityOptions): Promise<OGRLayerIdentity> {
106
112
  const { stdout } = await runFile(
@@ -127,16 +133,16 @@ export async function readOGRLayerIdentity(options: ReadOGRLayerIdentityOptions)
127
133
  throw new Error(
128
134
  options.layer === undefined
129
135
  ? `${options.context}: ${options.path} carries no readable layer`
130
- : `${options.context}: ${options.path} does not carry a layer named ${JSON.stringify(options.layer)}`
136
+ : `${options.context}: ${options.path} does not carry a layer named ${stringifyJSON(options.layer)}`
131
137
  )
132
138
  }
133
139
 
134
140
  if (options.layer !== undefined && described.name !== options.layer) {
135
- throw new Error(`${options.context}: ${options.path} does not carry a layer named ${JSON.stringify(options.layer)}`)
141
+ throw new Error(`${options.context}: ${options.path} does not carry a layer named ${stringifyJSON(options.layer)}`)
136
142
  }
137
143
 
138
- // The subject a refusal names: the layer where one was asked for, the dataset itself where the source's own first
139
- // layer answered.
144
+ // The subject a refusal names: the layer where one was asked for, the dataset itself
145
+ // where the source's own first layer answered.
140
146
  const subject = options.layer ?? options.path
141
147
 
142
148
  const geometry = described.geometryFields?.[0]
@@ -146,7 +152,7 @@ export async function readOGRLayerIdentity(options: ReadOGRLayerIdentityOptions)
146
152
  throw new TypeError(
147
153
  `${options.context}: ${subject} declares no EPSG authority code — ${
148
154
  options.messages?.noAuthorityCode ??
149
- "the projection cannot be checked, and reading its metres as degrees is silent"
155
+ "the projection cannot be checked, and reading its meters as degrees is silent"
150
156
  }`
151
157
  )
152
158
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/geometries/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/geometries/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/google/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,kBAAkB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/google/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,kBAAkB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/h3/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW,EAAgB,MAAM,UAAU,CAAA;AAEtE,cAAc,UAAU,CAAA;AACxB,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AAEjC;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,WAAW,EAAE,UAAU,SAAK,GAAG,QAAQ,CAOlF;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAO7D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/h3/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC,OAAO,EAAE,QAAQ,EAAqB,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAiC,YAAY,EAAE,MAAM,UAAU,CAAA;AAEtE,cAAc,UAAU,CAAA;AACxB,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AAEjC;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAsB,EAAE,UAAU,GAAG,EAAE;IACvE,MAAM,IAAI,GAAG,YAAY,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;IAEhD,2DAA2D;IAC3D,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;IAEhD,OAAO,IAAI,QAAQ,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAA;AAC3C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC9C,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;IAEhD,OAAO;QACN,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;KAClC,CAAA;AACF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/projection/index.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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/projection/index.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 +0,0 @@
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"}
@@ -1 +0,0 @@
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 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/tools/ogr/index.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,E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