@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.
- package/README.md +2 -2
- package/lib/bbox.ts +41 -34
- package/lib/coordinate/bounds.ts +2 -2
- package/lib/coordinate/formats.ts +10 -27
- package/lib/distance.ts +53 -27
- package/lib/feature.ts +2 -2
- package/lib/geometries/point.ts +41 -33
- package/lib/geometries/polygon.ts +24 -128
- package/lib/geometries/ring-blob.ts +33 -130
- package/lib/google/place-id.ts +4 -2
- package/lib/h3/cell.ts +21 -76
- package/lib/h3/coverage.ts +11 -7
- package/lib/h3/interior-cells.ts +13 -34
- package/lib/h3/polygon-cells.ts +59 -165
- package/lib/{h3/index.ts → h3.ts} +1 -1
- package/lib/index.ts +5 -5
- package/lib/objects.ts +6 -6
- package/lib/open-location-code.ts +11 -42
- package/lib/osgb36.ts +28 -187
- package/lib/polyline.ts +5 -3
- package/lib/position.ts +18 -2
- package/lib/projection/transform.ts +39 -40
- package/lib/{projection/index.ts → projection.ts} +1 -1
- package/lib/well-known-text.ts +8 -8
- package/out/bbox.d.ts +17 -14
- package/out/bbox.d.ts.map +1 -1
- package/out/bbox.js +32 -23
- package/out/bbox.js.map +1 -1
- package/out/coordinate/bounds.d.ts +2 -2
- package/out/coordinate/bounds.js +2 -2
- package/out/coordinate/formats.d.ts +8 -11
- package/out/coordinate/formats.d.ts.map +1 -1
- package/out/coordinate/formats.js +10 -27
- package/out/coordinate/formats.js.map +1 -1
- package/out/distance.d.ts +48 -25
- package/out/distance.d.ts.map +1 -1
- package/out/distance.js +53 -27
- package/out/distance.js.map +1 -1
- package/out/feature.d.ts +2 -2
- package/out/feature.d.ts.map +1 -1
- package/out/geometries/point.d.ts +30 -22
- package/out/geometries/point.d.ts.map +1 -1
- package/out/geometries/point.js +35 -29
- package/out/geometries/point.js.map +1 -1
- package/out/geometries/polygon.d.ts +23 -122
- package/out/geometries/polygon.d.ts.map +1 -1
- package/out/geometries/polygon.js +13 -41
- package/out/geometries/polygon.js.map +1 -1
- package/out/geometries/ring-blob.d.ts +23 -109
- package/out/geometries/ring-blob.d.ts.map +1 -1
- package/out/geometries/ring-blob.js +29 -115
- package/out/geometries/ring-blob.js.map +1 -1
- package/out/{geometries/index.js → geometries.d.ts} +1 -1
- package/out/geometries.d.ts.map +1 -0
- package/out/{geometries/index.d.ts → geometries.js} +1 -1
- package/out/geometries.js.map +1 -0
- package/out/google/place-id.d.ts +4 -2
- package/out/google/place-id.d.ts.map +1 -1
- package/out/google/place-id.js.map +1 -1
- package/out/{google/index.d.ts → google.d.ts} +1 -1
- package/out/google.d.ts.map +1 -0
- package/out/{google/index.js → google.js} +1 -1
- package/out/google.js.map +1 -0
- package/out/h3/cell.d.ts +19 -73
- package/out/h3/cell.d.ts.map +1 -1
- package/out/h3/cell.js +20 -63
- package/out/h3/cell.js.map +1 -1
- package/out/h3/coverage.d.ts +11 -7
- package/out/h3/coverage.d.ts.map +1 -1
- package/out/h3/coverage.js +11 -7
- package/out/h3/coverage.js.map +1 -1
- package/out/h3/interior-cells.d.ts +9 -28
- package/out/h3/interior-cells.d.ts.map +1 -1
- package/out/h3/interior-cells.js +13 -32
- package/out/h3/interior-cells.js.map +1 -1
- package/out/h3/polygon-cells.d.ts +28 -120
- package/out/h3/polygon-cells.d.ts.map +1 -1
- package/out/h3/polygon-cells.js +48 -146
- package/out/h3/polygon-cells.js.map +1 -1
- package/out/{h3/index.d.ts → h3.d.ts} +2 -2
- package/out/h3.d.ts.map +1 -0
- package/out/{h3/index.js → h3.js} +2 -2
- package/out/h3.js.map +1 -0
- package/out/index.d.ts +5 -5
- package/out/index.d.ts.map +1 -1
- package/out/index.js +5 -5
- package/out/index.js.map +1 -1
- package/out/objects.d.ts +6 -6
- package/out/open-location-code.d.ts +11 -22
- package/out/open-location-code.d.ts.map +1 -1
- package/out/open-location-code.js +9 -40
- package/out/open-location-code.js.map +1 -1
- package/out/osgb36.d.ts +21 -97
- package/out/osgb36.d.ts.map +1 -1
- package/out/osgb36.js +12 -165
- package/out/osgb36.js.map +1 -1
- package/out/polyline.d.ts +5 -3
- package/out/polyline.d.ts.map +1 -1
- package/out/polyline.js +5 -3
- package/out/polyline.js.map +1 -1
- package/out/position.d.ts +16 -2
- package/out/position.d.ts.map +1 -1
- package/out/position.js.map +1 -1
- package/out/projection/transform.d.ts +30 -27
- package/out/projection/transform.d.ts.map +1 -1
- package/out/projection/transform.js +14 -16
- package/out/projection/transform.js.map +1 -1
- package/out/{projection/index.d.ts → projection.d.ts} +2 -2
- package/out/projection.d.ts.map +1 -0
- package/out/{projection/index.js → projection.js} +2 -2
- package/out/projection.js.map +1 -0
- package/out/{regions/index.js → regions.d.ts} +1 -1
- package/out/regions.d.ts.map +1 -0
- package/out/{regions/index.d.ts → regions.js} +1 -1
- package/out/regions.js.map +1 -0
- package/out/tools/ogr/stream.d.ts +21 -11
- package/out/tools/ogr/stream.d.ts.map +1 -1
- package/out/tools/ogr/stream.js +16 -9
- package/out/tools/ogr/stream.js.map +1 -1
- package/out/tools/{ogr/index.d.ts → ogr.d.ts} +14 -11
- package/out/tools/ogr.d.ts.map +1 -0
- package/out/tools/{ogr/index.js → ogr.js} +18 -14
- package/out/tools/ogr.js.map +1 -0
- package/out/tools/tsconfig.tsbuildinfo +1 -0
- package/out/tsconfig.test.tsbuildinfo +1 -1
- package/out/well-known-text.d.ts +8 -8
- package/out/well-known-text.js +7 -7
- package/package.json +35 -127
- package/{lib/tools → tools}/ogr/stream.ts +25 -14
- package/{lib/tools/ogr/index.ts → tools/ogr.ts} +25 -19
- package/out/geometries/index.d.ts.map +0 -1
- package/out/geometries/index.js.map +0 -1
- package/out/google/index.d.ts.map +0 -1
- package/out/google/index.js.map +0 -1
- package/out/h3/index.d.ts.map +0 -1
- package/out/h3/index.js.map +0 -1
- package/out/projection/index.d.ts.map +0 -1
- package/out/projection/index.js.map +0 -1
- package/out/regions/index.d.ts.map +0 -1
- package/out/regions/index.js.map +0 -1
- package/out/tools/ogr/index.d.ts.map +0 -1
- package/out/tools/ogr/index.js.map +0 -1
- /package/lib/{geometries/index.ts → geometries.ts} +0 -0
- /package/lib/{google/index.ts → google.ts} +0 -0
- /package/lib/{regions/index.ts → regions.ts} +0 -0
package/out/polyline.js.map
CHANGED
|
@@ -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
|
|
1
|
+
{"version":3,"file":"polyline.js","sourceRoot":"","sources":["../lib/polyline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC;;;;;;GAMG;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;;;;;;GAMG;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,CAAA;QACjC,MAAM,CAAC,GAAG,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;QAC7C,IAAI,CAAC,IAAI,CA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|
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
|
|
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
|
package/out/position.d.ts.map
CHANGED
|
@@ -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;
|
|
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,M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vG;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAMhF;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,wBAAwB,CAQ3F;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
package/out/position.js.map
CHANGED
|
@@ -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;
|
|
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;AAkBtE;;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,C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AAE,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"}
|
|
@@ -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
|
|
6
|
+
* Ask PROJ which datum transformation it would choose. Refuse a ballpark operation.
|
|
7
7
|
*
|
|
8
|
-
* PROJ
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
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
|
|
17
|
-
* not
|
|
18
|
-
*
|
|
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
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
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
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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`
|
|
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
|
|
64
|
-
*
|
|
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":"
|
|
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
|
-
*
|
|
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.
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
|
|
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
|
|
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
|
|
33
|
-
*
|
|
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
|
|
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;
|
|
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,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
|
|
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=
|
|
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
|
|
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=
|
|
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"}
|
|
@@ -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"}
|
|
@@ -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
|
|
11
|
-
*
|
|
12
|
-
*
|
|
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.
|
|
22
|
-
*
|
|
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
|
|
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)
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
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
|
|
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":["../../../
|
|
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"}
|
package/out/tools/ogr/stream.js
CHANGED
|
@@ -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.
|
|
14
|
-
*
|
|
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
|
|
35
|
-
//
|
|
36
|
-
//
|
|
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)
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
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":["../../../
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../../tools/ogr/stream.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C,MAAM,gBAAgB,GAAG,IAAI,CAAA;AAC7B,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAmB7B;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,IAAgC,EAAE,OAAe;IAC7E,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,CAAA;IAEhC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;QACzC,MAAM,IAAI,KAAK,CAAA;IAChB,CAAC,CAAC,CAAA;IAEF,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrD,KAAK,CAAC,EA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AAC,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
|
|
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.
|
|
38
|
-
*
|
|
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
|
|
43
|
-
*
|
|
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
|
|
69
|
+
* After `declares no epsg authority code — `.
|
|
68
70
|
*/
|
|
69
71
|
noAuthorityCode?: string;
|
|
70
72
|
/**
|
|
71
|
-
* After `expected
|
|
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
|
|
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
|
|
84
|
-
*
|
|
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=
|
|
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
|
|
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
|
|
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`.
|
|
24
|
-
*
|
|
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
|
|
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
|
|
31
|
-
*
|
|
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 ${
|
|
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 ${
|
|
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
|
|
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
|
|
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=
|
|
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,MAA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