@mailwoman/soil 10.0.0 → 10.2.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 +118 -116
- package/lib/index.ts +88 -113
- package/lib/paths.ts +24 -0
- package/lib/schema.ts +189 -134
- package/lib/vocabulary.ts +40 -107
- package/out/index.d.ts +59 -77
- package/out/index.d.ts.map +1 -1
- package/out/index.js +38 -79
- package/out/index.js.map +1 -1
- package/out/paths.d.ts +19 -0
- package/out/paths.d.ts.map +1 -0
- package/out/paths.js +21 -0
- package/out/paths.js.map +1 -0
- package/out/schema.d.ts +183 -132
- package/out/schema.d.ts.map +1 -1
- package/out/schema.js +32 -32
- package/out/schema.js.map +1 -1
- package/out/sdk/acquire.d.ts +15 -24
- package/out/sdk/acquire.d.ts.map +1 -1
- package/out/sdk/acquire.js +6 -21
- package/out/sdk/acquire.js.map +1 -1
- package/out/sdk/build-soil.d.ts +67 -70
- package/out/sdk/build-soil.d.ts.map +1 -1
- package/out/sdk/build-soil.js +67 -97
- package/out/sdk/build-soil.js.map +1 -1
- package/out/sdk/cell-tiers.d.ts +7 -19
- package/out/sdk/cell-tiers.d.ts.map +1 -1
- package/out/sdk/cell-tiers.js +21 -40
- package/out/sdk/cell-tiers.js.map +1 -1
- package/out/sdk/cells.d.ts +15 -41
- package/out/sdk/cells.d.ts.map +1 -1
- package/out/sdk/cells.js +11 -38
- package/out/sdk/cells.js.map +1 -1
- package/out/sdk/client.d.ts +24 -49
- package/out/sdk/client.d.ts.map +1 -1
- package/out/sdk/client.js +20 -64
- package/out/sdk/client.js.map +1 -1
- package/out/sdk/download.d.ts +24 -47
- package/out/sdk/download.d.ts.map +1 -1
- package/out/sdk/download.js +15 -55
- package/out/sdk/download.js.map +1 -1
- package/out/sdk/ingest/chunk.d.ts +29 -25
- package/out/sdk/ingest/chunk.d.ts.map +1 -1
- package/out/sdk/ingest/chunk.js +18 -16
- package/out/sdk/ingest/chunk.js.map +1 -1
- package/out/sdk/ingest/worker.d.ts +9 -0
- package/out/sdk/ingest/worker.d.ts.map +1 -0
- package/out/{scripts/ingest-chunk.js → sdk/ingest/worker.js} +15 -14
- package/out/sdk/ingest/worker.js.map +1 -0
- package/out/sdk/ingest.d.ts +122 -0
- package/out/sdk/ingest.d.ts.map +1 -0
- package/out/sdk/ingest.js +127 -0
- package/out/sdk/ingest.js.map +1 -0
- package/out/sdk/measure-resolutions.d.ts +6 -17
- package/out/sdk/measure-resolutions.d.ts.map +1 -1
- package/out/sdk/measure-resolutions.js +4 -16
- package/out/sdk/measure-resolutions.js.map +1 -1
- package/out/sdk/reduce.d.ts +33 -59
- package/out/sdk/reduce.d.ts.map +1 -1
- package/out/sdk/reduce.js +48 -79
- package/out/sdk/reduce.js.map +1 -1
- package/out/sdk/survey-area.d.ts +16 -48
- package/out/sdk/survey-area.d.ts.map +1 -1
- package/out/sdk/survey-area.js +35 -79
- package/out/sdk/survey-area.js.map +1 -1
- package/out/sdk/tabular.d.ts +32 -31
- package/out/sdk/tabular.d.ts.map +1 -1
- package/out/sdk/tabular.js +57 -49
- package/out/sdk/tabular.js.map +1 -1
- package/out/sdk/test-kit.d.ts +57 -0
- package/out/sdk/test-kit.d.ts.map +1 -0
- package/out/{test-kit.js → sdk/test-kit.js} +18 -39
- package/out/sdk/test-kit.js.map +1 -0
- package/out/sdk/verify.d.ts +17 -53
- package/out/sdk/verify.d.ts.map +1 -1
- package/out/sdk/verify.js +27 -85
- package/out/sdk/verify.js.map +1 -1
- package/out/vocabulary.d.ts +37 -103
- package/out/vocabulary.d.ts.map +1 -1
- package/out/vocabulary.js +34 -107
- package/out/vocabulary.js.map +1 -1
- package/package.json +37 -191
- package/{lib/sdk → sdk}/acquire.ts +18 -28
- package/{lib/sdk → sdk}/build-soil.ts +116 -130
- package/{lib/sdk → sdk}/cell-tiers.ts +22 -41
- package/{lib/sdk → sdk}/cells.ts +17 -43
- package/sdk/client.ts +147 -0
- package/sdk/download.ts +131 -0
- package/{lib/sdk → sdk}/ingest/chunk.ts +35 -27
- package/{lib/scripts/ingest-chunk.ts → sdk/ingest/worker.ts} +14 -13
- package/sdk/ingest.ts +255 -0
- package/{lib/sdk → sdk}/measure-resolutions.ts +6 -17
- package/sdk/reduce.ts +344 -0
- package/{lib/sdk → sdk}/survey-area.ts +49 -88
- package/{lib/sdk → sdk}/tabular.ts +61 -52
- package/{lib → sdk}/test-kit.ts +19 -41
- package/sdk/verify.ts +313 -0
- package/lib/sdk/client.ts +0 -184
- package/lib/sdk/download.ts +0 -161
- package/lib/sdk/index.ts +0 -20
- package/lib/sdk/ingest/index.ts +0 -278
- package/lib/sdk/reduce.ts +0 -375
- package/lib/sdk/verify.ts +0 -369
- package/out/scripts/ingest-chunk.d.ts +0 -11
- package/out/scripts/ingest-chunk.d.ts.map +0 -1
- package/out/scripts/ingest-chunk.js.map +0 -1
- package/out/sdk/index.d.ts +0 -20
- package/out/sdk/index.d.ts.map +0 -1
- package/out/sdk/index.js +0 -20
- package/out/sdk/index.js.map +0 -1
- package/out/sdk/ingest/index.d.ts +0 -132
- package/out/sdk/ingest/index.d.ts.map +0 -1
- package/out/sdk/ingest/index.js +0 -170
- package/out/sdk/ingest/index.js.map +0 -1
- package/out/test-kit.d.ts +0 -79
- package/out/test-kit.d.ts.map +0 -1
- package/out/test-kit.js.map +0 -1
package/out/vocabulary.js
CHANGED
|
@@ -2,73 +2,41 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* NRCS's own words, as data: the product identity, the licence sentence it ships inside every archive,
|
|
7
|
-
* the acknowledgement it asks for, and the caveats that decide what a reading may claim.
|
|
8
|
-
*
|
|
9
|
-
* THE RATING VOCABULARY IS NOT HERE, BECAUSE THE AUTHORITY SHIPS IT. `msdomdet.txt` inside each survey
|
|
10
|
-
* area's tabular export carries the declared domain for every `Choice` column, WITH the authority's own
|
|
11
|
-
* prose definition of each member — capability classes 1 through 8, subclasses `c`/`e`/`s`/`w`, the 28
|
|
12
|
-
* farmland classifications, the six component kinds. So the layer reads the domain out of the file it
|
|
13
|
-
* ingested rather than transcribing it from the National Soil Survey Handbook, and an out-of-domain value
|
|
14
|
-
* throws: an unknown code is a source-schema change, which is the event a reader most needs to hear
|
|
15
|
-
* about, and coercing it to a nearest neighbour or to NULL converts "the source changed" into "there is
|
|
16
|
-
* nothing here".
|
|
17
|
-
*
|
|
18
|
-
* THE FARMLAND VOCABULARY IS CONDITIONAL AND THE CONDITION IS THE CLAIM. 28 declared values, of which 24
|
|
19
|
-
* carry an "if" — `Prime farmland if drained`, `Prime farmland if irrigated and reclaimed of excess salts
|
|
20
|
-
* and sodium`. A boolean `arable` column would be this layer's invention rather than the authority's
|
|
21
|
-
* statement, so the string is stored whole.
|
|
22
|
-
*
|
|
23
|
-
* AND TWO OF ITS CATEGORIES TRAVEL WHILE THE OTHERS DO NOT. 7 CFR 657.5 defines prime farmland and unique
|
|
24
|
-
* farmland nationally against nine specific criteria; §657.5(c) and (d) hand "additional farmland of
|
|
25
|
-
* statewide importance" and "of local importance" to state and local agencies respectively. So
|
|
26
|
-
* `Farmland of statewide importance` in Iowa and in Georgia are not the same claim, and a consumer that
|
|
27
|
-
* pooled them into one rank would be pooling incompatible vocabularies. {@link FarmlandScope} carries
|
|
28
|
-
* that distinction into the artifact rather than leaving it in a document.
|
|
29
5
|
*/
|
|
30
6
|
/**
|
|
31
|
-
* The
|
|
32
|
-
*
|
|
33
|
-
* States".
|
|
7
|
+
* The prefix of every soil layer name.
|
|
8
|
+
* The reader rejects an artifact whose layer name lacks it.
|
|
34
9
|
*/
|
|
35
10
|
export const SOIL_LAYER_NAME_PREFIX = "soil-capability-nrcs-ssurgo-";
|
|
36
11
|
/**
|
|
37
|
-
*
|
|
12
|
+
* Returns the layer name for a build over `region`.
|
|
38
13
|
*/
|
|
39
14
|
export function soilLayerName(region) {
|
|
40
15
|
return `${SOIL_LAYER_NAME_PREFIX}${region.toLowerCase()}`;
|
|
41
16
|
}
|
|
42
17
|
/**
|
|
43
|
-
* The pilot region
|
|
18
|
+
* The pilot region, Iowa.
|
|
44
19
|
*/
|
|
45
20
|
export const SOIL_PILOT_REGION = "ia";
|
|
46
21
|
/**
|
|
47
|
-
* The acknowledgement
|
|
48
|
-
*
|
|
49
|
-
* from these data", so it rides in `layer_manifest.attribution`.
|
|
22
|
+
* The agency acknowledgement that the SSURGO use constraints require,
|
|
23
|
+
* written to `layer_manifest.attribution`.
|
|
50
24
|
*/
|
|
51
25
|
export const SSURGO_ATTRIBUTION = "U.S. Department of Agriculture, Natural Resources Conservation Service";
|
|
52
26
|
/**
|
|
53
|
-
* The
|
|
54
|
-
*
|
|
55
|
-
* A public-domain identifier, and the grant behind it is the producing agency's own sentence rather than a catalogue
|
|
56
|
-
* field: data.gov's entry points at `usa.gov/publicdomain/label/1.0/`, which redirects to a page that declines a
|
|
57
|
-
* blanket grant and tells the reader to check with the agency. The agency was checked at the strongest available place
|
|
58
|
-
* — the FGDC metadata NRCS ships inside the archive — and it says {@link SSURGO_PUBLIC_INFORMATION_SENTENCE}.
|
|
27
|
+
* The public-domain license expression written to `layer_manifest.license`, granted by
|
|
28
|
+
* {@link SSURGO_PUBLIC_INFORMATION_SENTENCE} in each archive's FGDC metadata.
|
|
59
29
|
*/
|
|
60
30
|
export const SSURGO_LICENSE = "LicenseRef-USGov-Public-Domain";
|
|
61
31
|
/**
|
|
62
|
-
* The
|
|
63
|
-
* survey-area archive.
|
|
32
|
+
* The public-information grant quoted from each survey area's FGDC use constraints.
|
|
64
33
|
*
|
|
65
|
-
* The
|
|
66
|
-
*
|
|
34
|
+
* The survey-area loader rejects an area whose metadata lacks it, since its
|
|
35
|
+
* absence signals a license change.
|
|
67
36
|
*/
|
|
68
37
|
export const SSURGO_PUBLIC_INFORMATION_SENTENCE = "This is public information";
|
|
69
38
|
/**
|
|
70
|
-
* The use constraints
|
|
71
|
-
* authority's own words rather than against this package's summary of them.
|
|
39
|
+
* The full SSURGO use constraints, quoted from the FGDC metadata.
|
|
72
40
|
*/
|
|
73
41
|
export const SSURGO_USE_CONSTRAINTS = "The U.S. Department of Agriculture, Natural Resources Conservation Service, should be acknowledged as the data " +
|
|
74
42
|
"source in products derived from these data. This data set is not designed for use as a primary regulatory tool " +
|
|
@@ -76,11 +44,10 @@ export const SSURGO_USE_CONSTRAINTS = "The U.S. Department of Agriculture, Natur
|
|
|
76
44
|
"interpreted by organizations, agencies, units of government, or others based on needs; however, they are " +
|
|
77
45
|
"responsible for the appropriate application.";
|
|
78
46
|
/**
|
|
79
|
-
*
|
|
80
|
-
* capability class that the survey declines to speak about a specific site.
|
|
47
|
+
* NRCS states these SSURGO limitations verbatim.
|
|
81
48
|
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
49
|
+
* Every reading includes them.
|
|
50
|
+
* They describe the map unit covering a point rather than a site-specific determination.
|
|
84
51
|
*/
|
|
85
52
|
export const SSURGO_PRODUCT_LIMITS = [
|
|
86
53
|
"The depicted soil boundaries, interpretations, and analysis derived from them do not eliminate the need for onsite sampling, testing, and detailed study of specific sites for intensive uses. Thus, these data and their interpretations are intended for planning purposes only.",
|
|
@@ -90,68 +57,41 @@ export const SSURGO_PRODUCT_LIMITS = [
|
|
|
90
57
|
"The difference in positional accuracy between the soil boundaries and special soil features locations in the field and their digitized map locations is unknown.",
|
|
91
58
|
];
|
|
92
59
|
/**
|
|
93
|
-
* The coverage statement
|
|
94
|
-
*
|
|
95
|
-
* It is the mapping at the survey's own scale, NOT a site-specific determination — which is why the observation reports
|
|
96
|
-
* what the survey assigns to the map unit covering a location and never whether the land can be farmed.
|
|
60
|
+
* The coverage statement: soil mapping is complete at survey scale inside a
|
|
61
|
+
* published survey area and absent outside one.
|
|
97
62
|
*/
|
|
98
63
|
export const SSURGO_COVERAGE_STATEMENT = "Soil surveys are published by survey area. Inside a published survey area the soil mapping is complete at the " +
|
|
99
64
|
"survey's own scale; land outside any published survey area has no soil map unit at all.";
|
|
100
65
|
/**
|
|
101
|
-
*
|
|
66
|
+
* The page that publishes the product's identity and update schedule.
|
|
102
67
|
*/
|
|
103
68
|
export const SSURGO_STATEMENT_URL = "https://www.nrcs.usda.gov/conservation-basics/natural-resource-concerns/soil/annual-soils-refresh";
|
|
104
69
|
/**
|
|
105
|
-
* The dataset identifier written
|
|
70
|
+
* The dataset identifier written to `layer_manifest.source`.
|
|
106
71
|
*/
|
|
107
72
|
export const SSURGO_SOURCE = "nrcs.usda.gov/SSURGO";
|
|
108
73
|
/**
|
|
109
|
-
* The
|
|
110
|
-
* GDAL resolves to this authority code — so no reprojection is needed before H3, and a survey area declaring anything
|
|
111
|
-
* else is a product change rather than a variation to absorb.
|
|
74
|
+
* The EPSG code that every SSURGO survey-area shapefile declares, required by the ingest by default.
|
|
112
75
|
*/
|
|
113
76
|
export const SSURGO_SOURCE_EPSG = 4326;
|
|
114
77
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* 7 CFR 657.5 defines prime and unique farmland against nine national criteria; (c) and (d) delegate statewide and
|
|
118
|
-
* local importance. A consumer comparing two states may compare the national categories and must not compare the
|
|
119
|
-
* delegated ones.
|
|
78
|
+
* The authorities that can set a farmland classification's criteria; `None` covers
|
|
79
|
+
* not-prime farmland and land with no classification.
|
|
120
80
|
*/
|
|
121
81
|
export const FarmlandScope = {
|
|
122
|
-
/**
|
|
123
|
-
* Criteria set by 7 CFR 657.5(a)–(b). Comparable across the country.
|
|
124
|
-
*/
|
|
125
82
|
Federal: "federal",
|
|
126
|
-
/**
|
|
127
|
-
* Criteria "determined by the appropriate State agency or agencies" — 7 CFR 657.5(c).
|
|
128
|
-
*/
|
|
129
83
|
State: "state",
|
|
130
|
-
/**
|
|
131
|
-
* Criteria "identified by the local agency or agencies concerned" — 7 CFR 657.5(d).
|
|
132
|
-
*/
|
|
133
84
|
Local: "local",
|
|
134
|
-
/**
|
|
135
|
-
* The value states no farmland importance at all.
|
|
136
|
-
*/
|
|
137
85
|
None: "none",
|
|
138
86
|
};
|
|
139
87
|
/**
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
* Matching on the phrase rather than on an enumerated list of the 28 values is deliberate: the domain grows — the
|
|
143
|
-
* conditional tail is generated by combining a base category with a condition — and a new `Farmland of statewide
|
|
144
|
-
* importance, if …` must land in {@link FarmlandScope.State} on the day it appears rather than silently defaulting to
|
|
145
|
-
* the comparable bucket.
|
|
88
|
+
* Classifies a `farmlndcl` value into a {@link FarmlandScope} by the phrase the regulation uses,
|
|
89
|
+
* so a conditional value such as `Farmland of statewide importance, if …` still gets the right scope.
|
|
146
90
|
*/
|
|
147
91
|
export function farmlandScope(value) {
|
|
148
92
|
if (!value)
|
|
149
93
|
return FarmlandScope.None;
|
|
150
94
|
const lowered = value.toLowerCase();
|
|
151
|
-
// FIRST, because it CONTAINS the phrase the federal test looks for. `Not prime farmland` is a declared value stating
|
|
152
|
-
// no farmland importance at all, and a substring test that ran the other way round would call it federally comparable
|
|
153
|
-
// prime farmland — which it is the exact negation of. It is also the most common value in the domain: 192,120 of the
|
|
154
|
-
// 339,191 national map units carry it.
|
|
155
95
|
if (lowered.startsWith("not prime farmland"))
|
|
156
96
|
return FarmlandScope.None;
|
|
157
97
|
if (lowered.includes("statewide importance"))
|
|
@@ -163,20 +103,13 @@ export function farmlandScope(value) {
|
|
|
163
103
|
return FarmlandScope.None;
|
|
164
104
|
}
|
|
165
105
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* These are polygons rather than holes — the same wall-to-wall discipline that makes them separable from land outside a
|
|
169
|
-
* survey area entirely. Measured nationally through Soil Data Access: 37 map units carry `NOTCOM` (`No Digital Data
|
|
170
|
-
* Available`) and 7 carry `NOTPUB` (`Not Public Information`).
|
|
106
|
+
* The upper-case map-unit symbols that NRCS gives a delineation it drew without soil mapping.
|
|
171
107
|
*/
|
|
172
108
|
export const SSURGO_NO_MAPPING_SYMBOLS = new Set(["NOTCOM", "NOTPUB"]);
|
|
173
109
|
/**
|
|
174
|
-
*
|
|
175
|
-
* `Area not surveyed, access denied`.
|
|
110
|
+
* The lower-case map-unit names that mark a delineation without soil mapping when its symbol does not.
|
|
176
111
|
*
|
|
177
|
-
*
|
|
178
|
-
* pending` and would also catch nothing else, but it would equally catch a real soil name beginning with those words,
|
|
179
|
-
* and there is no such thing to be gained by guessing.
|
|
112
|
+
* The match uses the whole name, since a prefix could also match a real soil name.
|
|
180
113
|
*/
|
|
181
114
|
export const SSURGO_NO_MAPPING_NAMES = new Set([
|
|
182
115
|
"area not surveyed, access denied",
|
|
@@ -184,29 +117,23 @@ export const SSURGO_NO_MAPPING_NAMES = new Set([
|
|
|
184
117
|
"no digital data available",
|
|
185
118
|
]);
|
|
186
119
|
/**
|
|
187
|
-
* The
|
|
188
|
-
*
|
|
189
|
-
* Its `interphr` is an index in [0, 1] — measured 0.001 to 0.991 nationally, 0.022 to 0.990 on `IA153` — and it is
|
|
190
|
-
* never blended with the capability class: they are two ratings from one authority answering different questions, and
|
|
191
|
-
* combining them would produce a number NRCS does not publish.
|
|
120
|
+
* The `cointerp.mrulename` of the productivity index this layer stores, kept apart from the capability
|
|
121
|
+
* class because a combination of the two would be a number NRCS does not publish.
|
|
192
122
|
*/
|
|
193
123
|
export const NCCPI_V3_RULE_NAME = "NCCPI - National Commodity Crop Productivity Index (Ver 3.0)";
|
|
194
124
|
/**
|
|
195
|
-
* The
|
|
196
|
-
* submodels (corn, soybeans, small grains, cotton), which this layer does not carry.
|
|
125
|
+
* The `cointerp.ruledepth` at which a rule reports its overall value instead of a crop submodel.
|
|
197
126
|
*/
|
|
198
127
|
export const COINTERP_OVERALL_RULE_DEPTH = "0";
|
|
199
128
|
/**
|
|
200
|
-
*
|
|
129
|
+
* The code of the area-times-component-percentage weighting that produced the per-cell shares.
|
|
201
130
|
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* lies in map units whose components are class 2" and "the components in this cell sum to 60% class 2" are different
|
|
205
|
-
* claims, and a reader holding only a share cannot tell which one it is holding.
|
|
131
|
+
* Component percentages have no location, so a share indicates how much of a cell
|
|
132
|
+
* lies in rated map units and not where the rating applies.
|
|
206
133
|
*/
|
|
207
134
|
export const SOIL_SHARE_WEIGHTING = "cell_area_x_comppct_r";
|
|
208
135
|
/**
|
|
209
|
-
* The
|
|
136
|
+
* The prose description of {@link SOIL_SHARE_WEIGHTING}, stored beside it in the artifact.
|
|
210
137
|
*/
|
|
211
138
|
export const SOIL_SHARE_WEIGHTING_DESCRIPTION = "Each map-unit delineation contributes the area of the cell it covers; that area is split across the delineation's " +
|
|
212
139
|
"components in proportion to comppct_r, the component's representative percentage of its map unit. Component " +
|
package/out/vocabulary.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vocabulary.js","sourceRoot":"","sources":["../lib/vocabulary.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"vocabulary.js","sourceRoot":"","sources":["../lib/vocabulary.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,8BAA8B,CAAA;AAEpE;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC3C,OAAO,GAAG,sBAAsB,GAAG,MAAM,CAAC,WAAW,EAAE,EAAE,CAAA;AAC1D,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAA;AAErC;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,wEAAwE,CAAA;AAE1G;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,gCAAgC,CAAA;AAE9D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,4BAA4B,CAAA;AAE9E;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAClC,iHAAiH;IACjH,iHAAiH;IACjH,kHAAkH;IAClH,2GAA2G;IAC3G,8CAA8C,CAAA;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA0B;IAC3D,oRAAoR;IACpR,yQAAyQ;IACzQ,8IAA8I;IAC9I,uIAAuI;IACvI,kKAAkK;CAClK,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GACrC,gHAAgH;IAChH,yFAAyF,CAAA;AAE1F;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAChC,mGAAmG,CAAA;AAEpG;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,sBAAsB,CAAA;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAA;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B,OAAO,EAAE,SAAS;IAElB,KAAK,EAAE,OAAO;IAEd,KAAK,EAAE,OAAO;IAEd,IAAI,EAAE,MAAM;CACH,CAAA;AAOV;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAgC;IAC7D,IAAI,CAAC,KAAK;QAAE,OAAO,aAAa,CAAC,IAAI,CAAA;IAErC,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,EAAE,CAAA;IAEnC,IAAI,OAAO,CAAC,UAAU,CAAC,oBAAoB,CAAC;QAAE,OAAO,aAAa,CAAC,IAAI,CAAA;IAEvE,IAAI,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QAAE,OAAO,aAAa,CAAC,KAAK,CAAA;IAExE,IAAI,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QAAE,OAAO,aAAa,CAAC,KAAK,CAAA;IAEpE,IAAI,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC;QAAE,OAAO,aAAa,CAAC,OAAO,CAAA;IAE7G,OAAO,aAAa,CAAC,IAAI,CAAA;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAwB,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAA;AAE3F;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC;IACnE,kCAAkC;IAClC,wBAAwB;IACxB,2BAA2B;CAC3B,CAAC,CAAA;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,8DAA8D,CAAA;AAEhG;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,uBAAuB,CAAA;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAC5C,oHAAoH;IACpH,8GAA8G;IAC9G,mHAAmH;IACnH,kFAAkF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/soil",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"description": "USDA NRCS SSURGO soil capability — acquisition, build, and the soil.db layer reader",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"farmland",
|
|
@@ -33,18 +33,19 @@
|
|
|
33
33
|
"out/**/*.d.ts",
|
|
34
34
|
"out/**/*.d.ts.map",
|
|
35
35
|
"README.md",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"**/*.tsx",
|
|
40
|
-
"!*.test.ts",
|
|
41
|
-
"!*.test.tsx",
|
|
36
|
+
"lib/**/*.ts",
|
|
37
|
+
"lib/**/*.tsx",
|
|
38
|
+
"sdk/**/*.ts",
|
|
42
39
|
"!**/*.test.ts",
|
|
43
|
-
"!**/*.test.tsx"
|
|
44
|
-
"!test/**"
|
|
40
|
+
"!**/*.test.tsx"
|
|
45
41
|
],
|
|
46
42
|
"type": "module",
|
|
47
43
|
"imports": {
|
|
44
|
+
"#sdk/*": {
|
|
45
|
+
"types": "./out/sdk/*.d.ts",
|
|
46
|
+
"node": "./out/sdk/*.js",
|
|
47
|
+
"default": "./out/sdk/*.js"
|
|
48
|
+
},
|
|
48
49
|
"#*": {
|
|
49
50
|
"types": "./out/*.d.ts",
|
|
50
51
|
"node": "./out/*.js",
|
|
@@ -58,95 +59,15 @@
|
|
|
58
59
|
"node": "./out/index.js",
|
|
59
60
|
"default": "./out/index.js"
|
|
60
61
|
},
|
|
61
|
-
"./
|
|
62
|
-
"types": "./out/
|
|
63
|
-
"node": "./out/
|
|
64
|
-
"default": "./out/
|
|
65
|
-
},
|
|
66
|
-
"./schema": {
|
|
67
|
-
"types": "./out/schema.d.ts",
|
|
68
|
-
"node": "./out/schema.js",
|
|
69
|
-
"default": "./out/schema.js"
|
|
70
|
-
},
|
|
71
|
-
"./vocabulary": {
|
|
72
|
-
"types": "./out/vocabulary.d.ts",
|
|
73
|
-
"node": "./out/vocabulary.js",
|
|
74
|
-
"default": "./out/vocabulary.js"
|
|
75
|
-
},
|
|
76
|
-
"./test-kit": {
|
|
77
|
-
"types": "./out/test-kit.d.ts",
|
|
78
|
-
"node": "./out/test-kit.js",
|
|
79
|
-
"default": "./out/test-kit.js"
|
|
80
|
-
},
|
|
81
|
-
"./sdk": {
|
|
82
|
-
"types": "./out/sdk/index.d.ts",
|
|
83
|
-
"node": "./out/sdk/index.js",
|
|
84
|
-
"default": "./out/sdk/index.js"
|
|
85
|
-
},
|
|
86
|
-
"./sdk/acquire": {
|
|
87
|
-
"types": "./out/sdk/acquire.d.ts",
|
|
88
|
-
"node": "./out/sdk/acquire.js",
|
|
89
|
-
"default": "./out/sdk/acquire.js"
|
|
90
|
-
},
|
|
91
|
-
"./sdk/build-soil": {
|
|
92
|
-
"types": "./out/sdk/build-soil.d.ts",
|
|
93
|
-
"node": "./out/sdk/build-soil.js",
|
|
94
|
-
"default": "./out/sdk/build-soil.js"
|
|
95
|
-
},
|
|
96
|
-
"./sdk/cell-tiers": {
|
|
97
|
-
"types": "./out/sdk/cell-tiers.d.ts",
|
|
98
|
-
"node": "./out/sdk/cell-tiers.js",
|
|
99
|
-
"default": "./out/sdk/cell-tiers.js"
|
|
100
|
-
},
|
|
101
|
-
"./sdk/cells": {
|
|
102
|
-
"types": "./out/sdk/cells.d.ts",
|
|
103
|
-
"node": "./out/sdk/cells.js",
|
|
104
|
-
"default": "./out/sdk/cells.js"
|
|
105
|
-
},
|
|
106
|
-
"./sdk/client": {
|
|
107
|
-
"types": "./out/sdk/client.d.ts",
|
|
108
|
-
"node": "./out/sdk/client.js",
|
|
109
|
-
"default": "./out/sdk/client.js"
|
|
62
|
+
"./sdk/*": {
|
|
63
|
+
"types": "./out/sdk/*.d.ts",
|
|
64
|
+
"node": "./out/sdk/*.js",
|
|
65
|
+
"default": "./out/sdk/*.js"
|
|
110
66
|
},
|
|
111
|
-
"
|
|
112
|
-
"types": "./out
|
|
113
|
-
"node": "./out
|
|
114
|
-
"default": "./out
|
|
115
|
-
},
|
|
116
|
-
"./sdk/ingest": {
|
|
117
|
-
"types": "./out/sdk/ingest/index.d.ts",
|
|
118
|
-
"node": "./out/sdk/ingest/index.js",
|
|
119
|
-
"default": "./out/sdk/ingest/index.js"
|
|
120
|
-
},
|
|
121
|
-
"./sdk/ingest-chunk": {
|
|
122
|
-
"types": "./out/sdk/ingest/chunk.d.ts",
|
|
123
|
-
"node": "./out/sdk/ingest/chunk.js",
|
|
124
|
-
"default": "./out/sdk/ingest/chunk.js"
|
|
125
|
-
},
|
|
126
|
-
"./sdk/measure-resolutions": {
|
|
127
|
-
"types": "./out/sdk/measure-resolutions.d.ts",
|
|
128
|
-
"node": "./out/sdk/measure-resolutions.js",
|
|
129
|
-
"default": "./out/sdk/measure-resolutions.js"
|
|
130
|
-
},
|
|
131
|
-
"./sdk/reduce": {
|
|
132
|
-
"types": "./out/sdk/reduce.d.ts",
|
|
133
|
-
"node": "./out/sdk/reduce.js",
|
|
134
|
-
"default": "./out/sdk/reduce.js"
|
|
135
|
-
},
|
|
136
|
-
"./sdk/survey-area": {
|
|
137
|
-
"types": "./out/sdk/survey-area.d.ts",
|
|
138
|
-
"node": "./out/sdk/survey-area.js",
|
|
139
|
-
"default": "./out/sdk/survey-area.js"
|
|
140
|
-
},
|
|
141
|
-
"./sdk/tabular": {
|
|
142
|
-
"types": "./out/sdk/tabular.d.ts",
|
|
143
|
-
"node": "./out/sdk/tabular.js",
|
|
144
|
-
"default": "./out/sdk/tabular.js"
|
|
145
|
-
},
|
|
146
|
-
"./sdk/verify": {
|
|
147
|
-
"types": "./out/sdk/verify.d.ts",
|
|
148
|
-
"node": "./out/sdk/verify.js",
|
|
149
|
-
"default": "./out/sdk/verify.js"
|
|
67
|
+
"./*": {
|
|
68
|
+
"types": "./out/*.d.ts",
|
|
69
|
+
"node": "./out/*.js",
|
|
70
|
+
"default": "./out/*.js"
|
|
150
71
|
}
|
|
151
72
|
},
|
|
152
73
|
"publishConfig": {
|
|
@@ -158,98 +79,23 @@
|
|
|
158
79
|
"node": "./out/index.js",
|
|
159
80
|
"default": "./out/index.js"
|
|
160
81
|
},
|
|
161
|
-
"./
|
|
162
|
-
"types": "./out/
|
|
163
|
-
"node": "./out/
|
|
164
|
-
"default": "./out/
|
|
82
|
+
"./sdk/*": {
|
|
83
|
+
"types": "./out/sdk/*.d.ts",
|
|
84
|
+
"node": "./out/sdk/*.js",
|
|
85
|
+
"default": "./out/sdk/*.js"
|
|
165
86
|
},
|
|
166
|
-
"
|
|
167
|
-
"types": "./out
|
|
168
|
-
"node": "./out
|
|
169
|
-
"default": "./out
|
|
170
|
-
},
|
|
171
|
-
"./vocabulary": {
|
|
172
|
-
"types": "./out/vocabulary.d.ts",
|
|
173
|
-
"node": "./out/vocabulary.js",
|
|
174
|
-
"default": "./out/vocabulary.js"
|
|
175
|
-
},
|
|
176
|
-
"./test-kit": {
|
|
177
|
-
"types": "./out/test-kit.d.ts",
|
|
178
|
-
"node": "./out/test-kit.js",
|
|
179
|
-
"default": "./out/test-kit.js"
|
|
180
|
-
},
|
|
181
|
-
"./sdk": {
|
|
182
|
-
"types": "./out/sdk/index.d.ts",
|
|
183
|
-
"node": "./out/sdk/index.js",
|
|
184
|
-
"default": "./out/sdk/index.js"
|
|
185
|
-
},
|
|
186
|
-
"./sdk/acquire": {
|
|
187
|
-
"types": "./out/sdk/acquire.d.ts",
|
|
188
|
-
"node": "./out/sdk/acquire.js",
|
|
189
|
-
"default": "./out/sdk/acquire.js"
|
|
190
|
-
},
|
|
191
|
-
"./sdk/build-soil": {
|
|
192
|
-
"types": "./out/sdk/build-soil.d.ts",
|
|
193
|
-
"node": "./out/sdk/build-soil.js",
|
|
194
|
-
"default": "./out/sdk/build-soil.js"
|
|
195
|
-
},
|
|
196
|
-
"./sdk/cell-tiers": {
|
|
197
|
-
"types": "./out/sdk/cell-tiers.d.ts",
|
|
198
|
-
"node": "./out/sdk/cell-tiers.js",
|
|
199
|
-
"default": "./out/sdk/cell-tiers.js"
|
|
200
|
-
},
|
|
201
|
-
"./sdk/cells": {
|
|
202
|
-
"types": "./out/sdk/cells.d.ts",
|
|
203
|
-
"node": "./out/sdk/cells.js",
|
|
204
|
-
"default": "./out/sdk/cells.js"
|
|
205
|
-
},
|
|
206
|
-
"./sdk/client": {
|
|
207
|
-
"types": "./out/sdk/client.d.ts",
|
|
208
|
-
"node": "./out/sdk/client.js",
|
|
209
|
-
"default": "./out/sdk/client.js"
|
|
210
|
-
},
|
|
211
|
-
"./sdk/download": {
|
|
212
|
-
"types": "./out/sdk/download.d.ts",
|
|
213
|
-
"node": "./out/sdk/download.js",
|
|
214
|
-
"default": "./out/sdk/download.js"
|
|
215
|
-
},
|
|
216
|
-
"./sdk/ingest": {
|
|
217
|
-
"types": "./out/sdk/ingest/index.d.ts",
|
|
218
|
-
"node": "./out/sdk/ingest/index.js",
|
|
219
|
-
"default": "./out/sdk/ingest/index.js"
|
|
220
|
-
},
|
|
221
|
-
"./sdk/ingest-chunk": {
|
|
222
|
-
"types": "./out/sdk/ingest/chunk.d.ts",
|
|
223
|
-
"node": "./out/sdk/ingest/chunk.js",
|
|
224
|
-
"default": "./out/sdk/ingest/chunk.js"
|
|
225
|
-
},
|
|
226
|
-
"./sdk/measure-resolutions": {
|
|
227
|
-
"types": "./out/sdk/measure-resolutions.d.ts",
|
|
228
|
-
"node": "./out/sdk/measure-resolutions.js",
|
|
229
|
-
"default": "./out/sdk/measure-resolutions.js"
|
|
230
|
-
},
|
|
231
|
-
"./sdk/reduce": {
|
|
232
|
-
"types": "./out/sdk/reduce.d.ts",
|
|
233
|
-
"node": "./out/sdk/reduce.js",
|
|
234
|
-
"default": "./out/sdk/reduce.js"
|
|
235
|
-
},
|
|
236
|
-
"./sdk/survey-area": {
|
|
237
|
-
"types": "./out/sdk/survey-area.d.ts",
|
|
238
|
-
"node": "./out/sdk/survey-area.js",
|
|
239
|
-
"default": "./out/sdk/survey-area.js"
|
|
240
|
-
},
|
|
241
|
-
"./sdk/tabular": {
|
|
242
|
-
"types": "./out/sdk/tabular.d.ts",
|
|
243
|
-
"node": "./out/sdk/tabular.js",
|
|
244
|
-
"default": "./out/sdk/tabular.js"
|
|
245
|
-
},
|
|
246
|
-
"./sdk/verify": {
|
|
247
|
-
"types": "./out/sdk/verify.d.ts",
|
|
248
|
-
"node": "./out/sdk/verify.js",
|
|
249
|
-
"default": "./out/sdk/verify.js"
|
|
87
|
+
"./*": {
|
|
88
|
+
"types": "./out/*.d.ts",
|
|
89
|
+
"node": "./out/*.js",
|
|
90
|
+
"default": "./out/*.js"
|
|
250
91
|
}
|
|
251
92
|
},
|
|
252
93
|
"imports": {
|
|
94
|
+
"#sdk/*": {
|
|
95
|
+
"types": "./out/sdk/*.d.ts",
|
|
96
|
+
"node": "./out/sdk/*.js",
|
|
97
|
+
"default": "./out/sdk/*.js"
|
|
98
|
+
},
|
|
253
99
|
"#*": {
|
|
254
100
|
"types": "./out/*.d.ts",
|
|
255
101
|
"node": "./out/*.js",
|
|
@@ -261,13 +107,13 @@
|
|
|
261
107
|
"test": "vitest run"
|
|
262
108
|
},
|
|
263
109
|
"dependencies": {
|
|
264
|
-
"@mailwoman/core": "10.
|
|
265
|
-
"@mailwoman/spatial": "10.
|
|
266
|
-
"@mailwoman/sqlite": "10.
|
|
110
|
+
"@mailwoman/core": "10.2.0",
|
|
111
|
+
"@mailwoman/spatial": "10.2.0",
|
|
112
|
+
"@mailwoman/sqlite": "10.2.0",
|
|
267
113
|
"h3-js": "^4.5.0",
|
|
268
|
-
"kysely": "^0.29.
|
|
269
|
-
"path-ts": "^2.
|
|
270
|
-
"spliterator": "^
|
|
114
|
+
"kysely": "^0.29.6",
|
|
115
|
+
"path-ts": "^2.5.0",
|
|
116
|
+
"spliterator": "^9.2.0"
|
|
271
117
|
},
|
|
272
118
|
"engines": {
|
|
273
119
|
"node": ">=24.18.0"
|
|
@@ -3,64 +3,56 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* takes.
|
|
8
|
-
*
|
|
9
|
-
* THE FRESHNESS QUESTION IS ANSWERED BY THE TABULAR SERVICE, NOT BY THE FILE HOST. `sacatalog.saverest` is
|
|
10
|
-
* the version-established date, and it is also what the archive's filename embeds — so one catalogue call
|
|
11
|
-
* both decides what to download and names the file. The download host cannot answer it: it refuses `HEAD`
|
|
12
|
-
* with 405 and ignores `Range`, so a length probe there is a full transfer.
|
|
13
|
-
*
|
|
14
|
-
* THE VINTAGE IS THE REFRESH THE BUILD INGESTED, AND IT IS ONE DATE FOR THE WHOLE ARTIFACT. NRCS performs
|
|
15
|
-
* ONE coordinated Annual Soils Refresh, each October 1; grouping `sacatalog` by year of `saverest` returns
|
|
16
|
-
* 2016: 1, 2025: 3,323, 2026: 56. So a region's areas share a refresh and the manifest can carry one
|
|
17
|
-
* `source_vintage` — the LATEST of the areas built, because that is the date after which nothing in the
|
|
18
|
-
* artifact changed. Every area's own date is kept per row in `soil_survey_area`, and so is the far older
|
|
19
|
-
* field-survey date, which is the number a currency claim actually turns on.
|
|
6
|
+
* Downloads a region's soil survey areas and turns them into builder inputs. The catalogue's `saverest` date picks the archive and the host rejects `HEAD` and ignores `Range`.
|
|
20
7
|
*/
|
|
21
8
|
|
|
9
|
+
import type { PathBuilderLike } from "path-ts"
|
|
10
|
+
|
|
22
11
|
import type { SurveyAreaInput } from "#sdk/build-soil"
|
|
23
12
|
import type { SoilDataAccessClient, SurveyAreaCatalogEntry } from "#sdk/client"
|
|
24
13
|
import { downloadSurveyArea, type SurveyAreaArchive } from "#sdk/download"
|
|
25
|
-
import { mapUnitShapefile, readSoilSourceIdentity, surveyAreaShapefile } from "#sdk/ingest
|
|
14
|
+
import { mapUnitShapefile, readSoilSourceIdentity, surveyAreaShapefile } from "#sdk/ingest"
|
|
26
15
|
import { readSurveyAreaAttributes, readSurveyAreaOutline } from "#sdk/survey-area"
|
|
27
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Options for {@link acquireRegion}.
|
|
19
|
+
*/
|
|
28
20
|
export interface AcquireRegionOptions {
|
|
29
21
|
client: SoilDataAccessClient
|
|
30
22
|
/**
|
|
31
|
-
* The survey-area symbol prefix
|
|
32
|
-
*
|
|
23
|
+
* The survey-area symbol prefix, where a state code such as `IA` selects a whole state
|
|
24
|
+
* and a full symbol such as `IA153` selects one area.
|
|
33
25
|
*/
|
|
34
26
|
prefix: string
|
|
35
27
|
/**
|
|
36
|
-
*
|
|
28
|
+
* The directory where downloaded archives are cached.
|
|
37
29
|
*/
|
|
38
|
-
cacheRoot:
|
|
30
|
+
cacheRoot: PathBuilderLike
|
|
39
31
|
/**
|
|
40
|
-
*
|
|
32
|
+
* The symbols to build from the catalogue's results, defaulting to every symbol.
|
|
41
33
|
*/
|
|
42
34
|
only?: ReadonlyArray<string>
|
|
43
35
|
onProgress?: (message: string) => void
|
|
44
36
|
}
|
|
45
37
|
|
|
46
38
|
/**
|
|
47
|
-
*
|
|
39
|
+
* The result of acquiring one region.
|
|
48
40
|
*/
|
|
49
41
|
export interface AcquiredRegion {
|
|
50
42
|
catalog: SurveyAreaCatalogEntry[]
|
|
51
43
|
archives: SurveyAreaArchive[]
|
|
52
44
|
areas: SurveyAreaInput[]
|
|
53
45
|
/**
|
|
54
|
-
* The
|
|
46
|
+
* The latest `saverest` date among the areas built, used as the artifact's source vintage.
|
|
55
47
|
*/
|
|
56
48
|
sourceVintage: string
|
|
57
49
|
}
|
|
58
50
|
|
|
59
51
|
/**
|
|
60
|
-
*
|
|
52
|
+
* Downloads every survey area that matches the prefix and turns each into a builder input.
|
|
61
53
|
*
|
|
62
|
-
* @throws {Error} When the catalogue
|
|
63
|
-
*
|
|
54
|
+
* @throws {Error} When the catalogue has no entry for the prefix, when `only` lists a symbol
|
|
55
|
+
* that the catalogue lacks, or when an area's archive, metadata or shapefile cannot be read.
|
|
64
56
|
*/
|
|
65
57
|
export async function acquireRegion(options: AcquireRegionOptions): Promise<AcquiredRegion> {
|
|
66
58
|
const catalog = await options.client.readSurveyAreaCatalog(options.prefix)
|
|
@@ -112,9 +104,7 @@ export async function acquireRegion(options: AcquireRegionOptions): Promise<Acqu
|
|
|
112
104
|
})
|
|
113
105
|
}
|
|
114
106
|
|
|
115
|
-
// The
|
|
116
|
-
// Taking the earliest would claim a currency the newest area does not have; taking today's date would claim one no
|
|
117
|
-
// area has.
|
|
107
|
+
// The latest refresh date is the date after which no entry in this artifact changed.
|
|
118
108
|
const sourceVintage = selected
|
|
119
109
|
.map((entry) => entry.saverest)
|
|
120
110
|
.toSorted()
|