@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/schema.d.ts
CHANGED
|
@@ -3,64 +3,70 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Typed schema for `soil.db
|
|
7
|
-
*
|
|
6
|
+
* Typed schema for `soil.db`. It defines the polygon truth table, its containment index and the shared reduction
|
|
7
|
+
* that both consumers read. It also defines the layer-interface tables from `@mailwoman/core/layers`.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* weights change silently.
|
|
9
|
+
* {@link SoilMapUnitAreaTable} stores the authority's unsimplified geometry.
|
|
10
|
+
* {@link SoilMapUnitCellTable} records which cells each delineation reaches and whether it fills them.
|
|
11
|
+
* {@link SoilCapabilityCellTable} is that index reduced once, at build time, into a per-cell
|
|
12
|
+
* distribution. A `partial` cell's contribution is weighted by the area it covers. The truth table keeps
|
|
13
|
+
* unsimplified rings so simplification cannot change those weights silently.
|
|
15
14
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `muaggatt.niccdcd` — its own dominant-condition capability class — beside `niccdcdpct`, the share that
|
|
21
|
-
* class actually covers, with an observed minimum of 2%. This table reproduces that pattern at cell grain
|
|
22
|
-
* rather than inventing one.
|
|
15
|
+
* The reduction stores a distribution instead of one winning class. Four separate shares record reasons for
|
|
16
|
+
* absence. Class 8 is a determination, so it contributes a class share. A fold that places a `notcom` polygon, a water body
|
|
17
|
+
* and an unrated series into "not arable" would produce a well-formed but wrong answer. The four shares preserve
|
|
18
|
+
* those distinctions.
|
|
23
19
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* polygon, a water body and an unrated series into "not arable" would produce a well-formed wrong answer,
|
|
28
|
-
* which is what the four shares exist to make impossible.
|
|
29
|
-
*
|
|
30
|
-
* `WITHOUT ROWID` ON THE CELL TABLES AND NEVER ON THE GEOMETRY TABLE. Small fixed-width rows probed by
|
|
31
|
-
* their exact primary key belong in the B-tree; a row carrying a geometry blob does not — clustering it
|
|
32
|
-
* into the B-tree makes every index page a geometry page.
|
|
20
|
+
* Cell tables use `without rowid`; the geometry table uses ordinary rowids. Small fixed-width rows are probed by
|
|
21
|
+
* their exact primary key, so they fit the B-tree. A geometry blob would make every index page a geometry page if
|
|
22
|
+
* stored in that B-tree.
|
|
33
23
|
*/
|
|
34
|
-
import type {
|
|
24
|
+
import type { layerschemadatabase } from "@mailwoman/core/layers";
|
|
25
|
+
import { type AreaCellIndexTable } from "@mailwoman/sqlite/schema-columns";
|
|
35
26
|
import { type Kysely } from "kysely";
|
|
36
27
|
/**
|
|
37
28
|
* Whether an H3 cell lies wholly inside one map-unit delineation, or is crossed by its boundary.
|
|
38
29
|
*/
|
|
39
30
|
export declare const SoilCellContainment: {
|
|
40
31
|
/**
|
|
41
|
-
* Every point in the cell is inside the delineation.
|
|
32
|
+
* Every point in the cell is inside the delineation.
|
|
33
|
+
*
|
|
34
|
+
* Answered from the index without reading geometry.
|
|
42
35
|
*/
|
|
43
36
|
readonly Whole: "whole";
|
|
44
37
|
/**
|
|
45
|
-
* The delineation's boundary crosses the cell.
|
|
38
|
+
* The delineation's boundary crosses the cell.
|
|
39
|
+
*
|
|
40
|
+
* The index has narrowed the candidates.
|
|
41
|
+
* The point test decides.
|
|
46
42
|
*/
|
|
47
43
|
readonly Partial: "partial";
|
|
48
44
|
};
|
|
49
45
|
export type SoilCellContainment = (typeof SoilCellContainment)[keyof typeof SoilCellContainment];
|
|
50
46
|
/**
|
|
51
|
-
* One map-unit delineation, verbatim.
|
|
52
|
-
*
|
|
47
|
+
* One map-unit delineation, verbatim.
|
|
48
|
+
*
|
|
49
|
+
* A plain rowid table.
|
|
50
|
+
* It holds a geometry blob.
|
|
51
|
+
* `without rowid` stores this shape inefficiently.
|
|
53
52
|
*/
|
|
54
53
|
export interface SoilMapUnitAreaTable {
|
|
55
54
|
/**
|
|
56
|
-
* `<areasymbol>:<ordinal>`
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
55
|
+
* `<areasymbol>:<ordinal>` identifies the survey area and this delineation's
|
|
56
|
+
* position in the authority's own shapefile order.
|
|
57
|
+
*
|
|
58
|
+
* SSURGO publishes no per-delineation key.
|
|
59
|
+
* `mukey` identifies the map unit.
|
|
60
|
+
*
|
|
61
|
+
* Each map unit has many delineations.
|
|
62
|
+
* The ordinal distinguishes each delineation row.
|
|
63
|
+
*
|
|
64
|
+
* Text allows the source to publish a non-numeric ID without a schema change.
|
|
60
65
|
*/
|
|
61
66
|
area_id: string;
|
|
62
67
|
/**
|
|
63
|
-
* The map unit this delineation
|
|
68
|
+
* The map unit that contains this delineation.
|
|
69
|
+
* NRCS uses this key to join every attribute.
|
|
64
70
|
*/
|
|
65
71
|
mukey: string;
|
|
66
72
|
areasymbol: string;
|
|
@@ -69,75 +75,76 @@ export interface SoilMapUnitAreaTable {
|
|
|
69
75
|
max_lat: number;
|
|
70
76
|
max_lon: number;
|
|
71
77
|
/**
|
|
72
|
-
* The authority's ring coordinates, unsimplified
|
|
78
|
+
* The authority's ring coordinates, unsimplified.
|
|
79
|
+
* See `@mailwoman/spatial`'s ring blob for the layout.
|
|
73
80
|
*/
|
|
74
81
|
rings: Uint8Array;
|
|
75
82
|
}
|
|
76
83
|
/**
|
|
77
|
-
*
|
|
84
|
+
* Records whether a delineation covers a whole cell or only part of it.
|
|
85
|
+
*
|
|
86
|
+
* Rows use the delineation as the key because the reduction weights by covered area.
|
|
87
|
+
* Two delineations from one map unit can reach the same cell while covering different ground.
|
|
78
88
|
*
|
|
79
|
-
*
|
|
80
|
-
* and two delineations of one map unit reaching the same cell cover different ground.
|
|
89
|
+
* `containment` is one of {@link SoilCellContainment}.
|
|
81
90
|
*/
|
|
82
|
-
export
|
|
83
|
-
/**
|
|
84
|
-
* 48-bit short H3 cell. Mixed-resolution: `whole` rows are compacted parent-ward, `partial` rows stay at the index
|
|
85
|
-
* resolution.
|
|
86
|
-
*/
|
|
87
|
-
h3_cell: number;
|
|
88
|
-
/**
|
|
89
|
-
* The resolution this row's cell was captured at. A short cell does not name its own resolution, and a table that
|
|
90
|
-
* mixes them cannot be probed without it.
|
|
91
|
-
*/
|
|
92
|
-
resolution: number;
|
|
93
|
-
area_id: string;
|
|
94
|
-
/**
|
|
95
|
-
* One of {@link SoilCellContainment}.
|
|
96
|
-
*/
|
|
97
|
-
containment: string;
|
|
98
|
-
}
|
|
91
|
+
export type SoilMapUnitCellTable = AreaCellIndexTable;
|
|
99
92
|
/**
|
|
100
|
-
* One
|
|
93
|
+
* One ssurgo map unit, the attribute row every delineation joins to.
|
|
101
94
|
*/
|
|
102
95
|
export interface SoilMapUnitTable {
|
|
103
96
|
mukey: string;
|
|
104
97
|
areasymbol: string;
|
|
105
98
|
/**
|
|
106
|
-
* The map unit symbol.
|
|
107
|
-
*
|
|
99
|
+
* The map unit symbol.
|
|
100
|
+
*
|
|
101
|
+
* `notcom` and `notpub` are meaningful values here rather than codes to skip.
|
|
102
|
+
* They mark a polygon the authority drew with no soil mapping behind it.
|
|
108
103
|
*/
|
|
109
104
|
musym: string;
|
|
110
105
|
muname: string;
|
|
111
106
|
/**
|
|
112
|
-
* `Consociation` | `Complex` | `Association` | `Undifferentiated group`,
|
|
113
|
-
*
|
|
114
|
-
*
|
|
107
|
+
* `Consociation` | `Complex` | `Association` | `Undifferentiated group`,
|
|
108
|
+
* from the authority's declared domain.
|
|
109
|
+
*
|
|
110
|
+
* A complex is nrcs's statement that two or more soils are intermingled
|
|
111
|
+
* and cannot be separated at the mapping scale.
|
|
112
|
+
* The mixture is the survey's finding rather than this layer's loss.
|
|
115
113
|
*/
|
|
116
114
|
mukind: string | null;
|
|
117
115
|
mustatus: string | null;
|
|
118
116
|
/**
|
|
119
|
-
* The full conditional string, verbatim.
|
|
120
|
-
*
|
|
117
|
+
* The full conditional string, verbatim.
|
|
118
|
+
*
|
|
119
|
+
* `Not prime farmland` is itself a declared value, while NULL means the map
|
|
120
|
+
* unit has no farmland classification.
|
|
121
121
|
*/
|
|
122
122
|
farmlndcl: string | null;
|
|
123
123
|
/**
|
|
124
|
-
* Which of {@link FarmlandScope} `farmlndcl` falls under
|
|
125
|
-
*
|
|
126
|
-
*
|
|
124
|
+
* Which of {@link FarmlandScope} `farmlndcl` falls under.
|
|
125
|
+
*
|
|
126
|
+
* Federal criteria travel between states, while delegated ones do not.
|
|
127
|
+
*
|
|
128
|
+
* Derived once at build time so a consumer never has to re-read 7 CFR 657.5 to know
|
|
129
|
+
* whether two rows are comparable.
|
|
127
130
|
*/
|
|
128
131
|
farmland_scope: string;
|
|
129
132
|
/**
|
|
130
|
-
*
|
|
133
|
+
* Nrcs's own dominant-condition capability class for the map unit, stored rather than recomputed.
|
|
131
134
|
*/
|
|
132
135
|
niccdcd: string | null;
|
|
133
136
|
/**
|
|
134
|
-
*
|
|
135
|
-
*
|
|
137
|
+
* The share that class actually covers.
|
|
138
|
+
*
|
|
139
|
+
* The pair is the pattern this layer's cell reduction reproduces at cell grain,
|
|
140
|
+
* so carrying both makes the two comparable.
|
|
136
141
|
*/
|
|
137
142
|
niccdcdpct: number | null;
|
|
138
143
|
/**
|
|
139
|
-
* Whether this map unit is a polygon with
|
|
140
|
-
*
|
|
144
|
+
* Whether this map unit is a polygon with no soil mapping behind it, such as `notcom`,
|
|
145
|
+
* `notpub`, access denied, or a map unit carrying no components at all.
|
|
146
|
+
*
|
|
147
|
+
* Such a map unit contributes to `nodata_share` and never to a class share.
|
|
141
148
|
*/
|
|
142
149
|
no_mapping: number;
|
|
143
150
|
}
|
|
@@ -148,17 +155,20 @@ export interface SoilComponentTable {
|
|
|
148
155
|
cokey: string;
|
|
149
156
|
mukey: string;
|
|
150
157
|
/**
|
|
151
|
-
* The component's representative percentage of its map unit
|
|
158
|
+
* The component's representative percentage of its map unit, the weight the reduction aggregates by.
|
|
152
159
|
*/
|
|
153
160
|
comppct_r: number;
|
|
154
161
|
compname: string | null;
|
|
155
162
|
/**
|
|
156
|
-
* `Miscellaneous area` is what separates
|
|
157
|
-
*
|
|
163
|
+
* `Miscellaneous area` is what separates not-rateable from unrated: a rock outcrop
|
|
164
|
+
* or a water body is a component the capability rating does not apply to,
|
|
165
|
+
* while an unrated series is one the survey did not rate.
|
|
158
166
|
*/
|
|
159
167
|
compkind: string | null;
|
|
160
168
|
/**
|
|
161
|
-
* Nonirrigated Land Capability Class, `"1"`–`"8"`.
|
|
169
|
+
* Nonirrigated Land Capability Class, `"1"`–`"8"`.
|
|
170
|
+
*
|
|
171
|
+
* NULL means not rated, never class 8.
|
|
162
172
|
*/
|
|
163
173
|
nirrcapcl: string | null;
|
|
164
174
|
/**
|
|
@@ -166,37 +176,47 @@ export interface SoilComponentTable {
|
|
|
166
176
|
*/
|
|
167
177
|
nirrcapscl: string | null;
|
|
168
178
|
/**
|
|
169
|
-
* The irrigated rating.
|
|
170
|
-
*
|
|
171
|
-
* is
|
|
179
|
+
* The irrigated rating.
|
|
180
|
+
*
|
|
181
|
+
* Populated only where irrigation is a considered use, so its absence states that
|
|
182
|
+
* the rating does not apply rather than anything about the land.
|
|
183
|
+
* The build stores it without reducing it.
|
|
172
184
|
*/
|
|
173
185
|
irrcapcl: string | null;
|
|
174
186
|
irrcapscl: string | null;
|
|
175
187
|
/**
|
|
176
|
-
* The
|
|
188
|
+
* The nccpi v3.0 overall index in [0, 1], under its own rule name.
|
|
189
|
+
*
|
|
190
|
+
* Never blended with the capability class.
|
|
177
191
|
*/
|
|
178
192
|
nccpi_v3: number | null;
|
|
179
193
|
}
|
|
180
194
|
/**
|
|
181
|
-
*
|
|
195
|
+
* The shared artifact both consumers read, one row per cell with the index reduced once.
|
|
182
196
|
*
|
|
183
|
-
* The result-level observation takes {@link SoilCapabilityCellTable.top_class} with the share it rests
|
|
184
|
-
* affordance vector takes `class_shares` plus the four absence shares as its axis.
|
|
185
|
-
*
|
|
197
|
+
* The result-level observation takes {@link SoilCapabilityCellTable.top_class} with the share it rests
|
|
198
|
+
* on, while the affordance vector takes `class_shares` plus the four absence shares as its axis.
|
|
199
|
+
* One artifact, one aggregation and one set of provenance rows, so the two
|
|
200
|
+
* consumers cannot disagree about what the ground is.
|
|
186
201
|
*/
|
|
187
202
|
export interface SoilCapabilityCellTable {
|
|
188
203
|
/**
|
|
189
|
-
* 48-bit short H3 cell at the declared index resolution.
|
|
190
|
-
*
|
|
204
|
+
* 48-bit short H3 cell at the declared index resolution.
|
|
205
|
+
*
|
|
206
|
+
* Single-resolution, unlike {@link SoilMapUnitCellTable}, because a consumer joins
|
|
207
|
+
* on this table and a mixed-resolution join key cannot serve that.
|
|
191
208
|
*/
|
|
192
209
|
h3_cell: number;
|
|
193
210
|
/**
|
|
194
|
-
* JSON: the authority's class codes mapped to their area-weighted share, sorted by descending share.
|
|
195
|
-
*
|
|
211
|
+
* JSON: the authority's class codes mapped to their area-weighted share, sorted by descending share.
|
|
212
|
+
*
|
|
213
|
+
* Shares above the declared truncation floor only.
|
|
214
|
+
* The remainder is in `other_share`.
|
|
196
215
|
*/
|
|
197
216
|
class_shares: string;
|
|
198
217
|
/**
|
|
199
|
-
* Mapped soil components carrying a NULL rating
|
|
218
|
+
* Mapped soil components carrying a NULL rating.
|
|
219
|
+
* The survey did not rate them.
|
|
200
220
|
*/
|
|
201
221
|
unrated_share: number;
|
|
202
222
|
/**
|
|
@@ -204,81 +224,104 @@ export interface SoilCapabilityCellTable {
|
|
|
204
224
|
*/
|
|
205
225
|
notrateable_share: number;
|
|
206
226
|
/**
|
|
207
|
-
* `
|
|
227
|
+
* `notcom`, `notpub` and access-denied map units: a polygon the authority drew,
|
|
228
|
+
* with no soil mapping behind it.
|
|
208
229
|
*/
|
|
209
230
|
nodata_share: number;
|
|
210
231
|
/**
|
|
211
|
-
* The truncated minority tail.
|
|
212
|
-
*
|
|
232
|
+
* The truncated minority tail.
|
|
233
|
+
*
|
|
234
|
+
* Stored explicitly so the five shares always sum to 1 and a reader can see how
|
|
235
|
+
* much was folded away rather than inferring it from a gap.
|
|
213
236
|
*/
|
|
214
237
|
other_share: number;
|
|
215
238
|
/**
|
|
216
|
-
* The fraction of the
|
|
239
|
+
* The fraction of the cell covered by any map-unit delineation at all.
|
|
240
|
+
*
|
|
241
|
+
* The five shares above are normalized over this value and sum to 1 exactly.
|
|
242
|
+
* A cell at a survey-area edge can fall partly outside every delineation.
|
|
217
243
|
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
* cell wholly inside the mapped area reads 1.
|
|
244
|
+
* This column prevents the unmapped remainder from deflating every class share.
|
|
245
|
+
*
|
|
246
|
+
* This schema prevents an absence from appearing as a small number.
|
|
247
|
+
* A cell wholly inside the mapped area reads 1.
|
|
222
248
|
*/
|
|
223
249
|
mapped_share: number;
|
|
224
250
|
/**
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
251
|
+
* Stores the largest class share and its proportion.
|
|
252
|
+
*
|
|
253
|
+
* This gives consumers an at-cell result and follows NRCS's `niccdcd`/`niccdcdpct` pattern.
|
|
254
|
+
*
|
|
255
|
+
* NULL when the cell has no class.
|
|
256
|
+
* This is a valid result.
|
|
257
|
+
*
|
|
258
|
+
* A cell that is 100% `unrated_share` is complete and has no capability reading.
|
|
228
259
|
*/
|
|
229
260
|
top_class: string | null;
|
|
230
261
|
top_class_share: number | null;
|
|
231
262
|
/**
|
|
232
|
-
* Which weighting produced the shares
|
|
233
|
-
*
|
|
263
|
+
* Which weighting produced the shares, one of {@link SOIL_SHARE_WEIGHTING}.
|
|
264
|
+
*
|
|
265
|
+
* Stored per row as well as in the manifest.
|
|
266
|
+
* A later build with different weighting must have a distinct record.
|
|
234
267
|
*/
|
|
235
268
|
weighting: string;
|
|
236
269
|
/**
|
|
237
|
-
* How many delineations reached this cell.
|
|
238
|
-
*
|
|
270
|
+
* How many delineations reached this cell.
|
|
271
|
+
*
|
|
272
|
+
* Supplies the denominator behind each share above.
|
|
273
|
+
* It also distinguishes a single-delineation cell from a crowded cell.
|
|
239
274
|
*/
|
|
240
275
|
delineations: number;
|
|
241
276
|
}
|
|
242
277
|
/**
|
|
243
|
-
* The authority's mapped footprint, one row per published survey area
|
|
244
|
-
* area's own metadata
|
|
278
|
+
* The authority's mapped footprint, one row per published survey area, derived from the
|
|
279
|
+
* survey-area outline and each area's own metadata rather than from the rated polygons.
|
|
245
280
|
*
|
|
246
|
-
*
|
|
247
|
-
* are
|
|
248
|
-
*
|
|
281
|
+
* The survey's §3.2 identifies rated polygons as an invalid source for this footprint.
|
|
282
|
+
* `notcom` and access-denied map units are inside the footprint and have no rating,
|
|
283
|
+
* so a footprint taken from the rated set would report them as unmapped even
|
|
284
|
+
* though the authority has declared exactly what they are.
|
|
249
285
|
*/
|
|
250
286
|
export interface SoilSurveyAreaTable {
|
|
251
287
|
areasymbol: string;
|
|
252
288
|
areaname: string;
|
|
253
289
|
/**
|
|
254
|
-
* The version-established date from `sacatalog.saverest
|
|
290
|
+
* The version-established date from `sacatalog.saverest`, the refresh and the manifest's vintage.
|
|
255
291
|
*/
|
|
256
292
|
saverest: string;
|
|
257
293
|
saversion: number | null;
|
|
258
294
|
/**
|
|
259
|
-
* The
|
|
295
|
+
* The oldest source citation date in the area's own fgdc lineage, the field
|
|
296
|
+
* survey the republished polygons rest on.
|
|
297
|
+
*
|
|
298
|
+
* This date differs from `saverest`.
|
|
299
|
+
* `IA153` records a 2025-09-09 refresh over a field survey published in 1960.
|
|
260
300
|
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
* consumer reading that as survey currency reads it wrong.
|
|
301
|
+
* The dataset's time-period-of-content ends at the refresh, so it does not state
|
|
302
|
+
* when the field survey occurred.
|
|
264
303
|
*/
|
|
265
304
|
survey_source_date: string | null;
|
|
266
305
|
/**
|
|
267
|
-
* The title of the source `survey_source_date
|
|
306
|
+
* The title of the source for `survey_source_date`.
|
|
307
|
+
* It lets readers check the date against its source.
|
|
268
308
|
*/
|
|
269
309
|
survey_source_title: string | null;
|
|
270
310
|
/**
|
|
271
|
-
* The scale of that original source
|
|
311
|
+
* The scale of that original source, 15840 for `IA153`'s 1960 survey.
|
|
272
312
|
*/
|
|
273
313
|
source_scale: number | null;
|
|
274
314
|
/**
|
|
275
|
-
* The scale the map units were
|
|
276
|
-
*
|
|
315
|
+
* The scale the map units were digitized at, from `legend.projectscale`, 12000 for `IA153`.
|
|
316
|
+
*
|
|
317
|
+
* This differs from `source_scale`.
|
|
318
|
+
* `source_scale` describes survey detail; `mapping_scale` describes drawing detail.
|
|
277
319
|
*/
|
|
278
320
|
mapping_scale: number | null;
|
|
279
321
|
/**
|
|
280
|
-
* The area the authority publishes for the survey area, in acres.
|
|
281
|
-
*
|
|
322
|
+
* The area the authority publishes for the survey area, in acres.
|
|
323
|
+
*
|
|
324
|
+
* The independent witness the ring-area check compares against.
|
|
282
325
|
*/
|
|
283
326
|
area_acres: number | null;
|
|
284
327
|
min_lat: number;
|
|
@@ -286,7 +329,7 @@ export interface SoilSurveyAreaTable {
|
|
|
286
329
|
max_lat: number;
|
|
287
330
|
max_lon: number;
|
|
288
331
|
/**
|
|
289
|
-
*
|
|
332
|
+
* The number of `layer_coverage` rows this survey area produced and their resolution.
|
|
290
333
|
*/
|
|
291
334
|
coverage_cells: number;
|
|
292
335
|
coverage_resolution: number;
|
|
@@ -294,13 +337,14 @@ export interface SoilSurveyAreaTable {
|
|
|
294
337
|
/**
|
|
295
338
|
* The authority's declared domain for one `Choice` column, read out of the `msdomdet.txt` the archive ships.
|
|
296
339
|
*
|
|
297
|
-
* Stored so a reader can refuse a code the layer
|
|
298
|
-
*
|
|
340
|
+
* Stored so a reader can refuse a code the layer cannot hold.
|
|
341
|
+
* The artifact also includes the authority's prose definition of "capability class 3"
|
|
342
|
+
* instead of requiring a separate handbook.
|
|
299
343
|
*/
|
|
300
344
|
export interface SoilVocabularyTable {
|
|
301
345
|
/**
|
|
302
|
-
* The domain name as
|
|
303
|
-
* `
|
|
346
|
+
* The domain name as nrcs spells it, such as `capability_class`, `capability_subclass`,
|
|
347
|
+
* `farmland_classification`, `component_kind` or `mapunit_kind`.
|
|
304
348
|
*/
|
|
305
349
|
domain: string;
|
|
306
350
|
/**
|
|
@@ -312,14 +356,14 @@ export interface SoilVocabularyTable {
|
|
|
312
356
|
*/
|
|
313
357
|
definition: string;
|
|
314
358
|
/**
|
|
315
|
-
*
|
|
359
|
+
* Each value's sequence records its order within the authority's domain.
|
|
316
360
|
*/
|
|
317
361
|
sequence: number;
|
|
318
362
|
}
|
|
319
363
|
/**
|
|
320
364
|
* Pass to `new DatabaseClient<SoilDatabase>(...)`.
|
|
321
365
|
*/
|
|
322
|
-
export interface SoilDatabase extends
|
|
366
|
+
export interface SoilDatabase extends layerschemadatabase {
|
|
323
367
|
soil_map_unit_area: SoilMapUnitAreaTable;
|
|
324
368
|
soil_map_unit_cell: SoilMapUnitCellTable;
|
|
325
369
|
soil_map_unit: SoilMapUnitTable;
|
|
@@ -329,17 +373,23 @@ export interface SoilDatabase extends LayerContractDatabase {
|
|
|
329
373
|
soil_vocabulary: SoilVocabularyTable;
|
|
330
374
|
}
|
|
331
375
|
/**
|
|
332
|
-
* The
|
|
333
|
-
*
|
|
376
|
+
* The subset of a Kysely handle the DDL touches.
|
|
377
|
+
*
|
|
378
|
+
* Kysely is invariant in its schema parameter, so naming only the members these
|
|
379
|
+
* functions call lets a caller pass its own wider handle.
|
|
334
380
|
*/
|
|
335
381
|
export type SoilSchemaHandle = Pick<Kysely<SoilDatabase>, "schema">;
|
|
336
382
|
/**
|
|
337
|
-
* Create `soil_map_unit_area`.
|
|
338
|
-
*
|
|
383
|
+
* Create `soil_map_unit_area`.
|
|
384
|
+
*
|
|
385
|
+
* A plain rowid table on purpose.
|
|
386
|
+
* The `rings` blob is exactly the payload `without rowid` penalizes.
|
|
339
387
|
*/
|
|
340
388
|
export declare function createSoilMapUnitAreaTable(db: SoilSchemaHandle): Promise<void>;
|
|
341
389
|
/**
|
|
342
|
-
* Create `soil_map_unit_cell
|
|
390
|
+
* Create `soil_map_unit_cell`, the containment index.
|
|
391
|
+
*
|
|
392
|
+
* Small fixed-width rows probed by their exact primary key.
|
|
343
393
|
*/
|
|
344
394
|
export declare function createSoilMapUnitCellTable(db: SoilSchemaHandle): Promise<void>;
|
|
345
395
|
/**
|
|
@@ -351,7 +401,8 @@ export declare function createSoilMapUnitTable(db: SoilSchemaHandle): Promise<vo
|
|
|
351
401
|
*/
|
|
352
402
|
export declare function createSoilComponentTable(db: SoilSchemaHandle): Promise<void>;
|
|
353
403
|
/**
|
|
354
|
-
* Create `soil_capability_cell
|
|
404
|
+
* Create `soil_capability_cell`.
|
|
405
|
+
* The reduction both consumers read.
|
|
355
406
|
*/
|
|
356
407
|
export declare function createSoilCapabilityCellTable(db: SoilSchemaHandle): Promise<void>;
|
|
357
408
|
/**
|
package/out/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../lib/schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../lib/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAIN,KAAK,kBAAkB,EACvB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAO,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEzC;;GAEG;AACH,eAAO,MAAM,mBAAmB;IAC/B;;;;OAIG;aACH,KAAK,EAAE,OAAO;IACd;;;;;OAKG;aACH,OAAO,EAAE,SAAS;CACT,CAAA;AAEV,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAA;AAEhG;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACpC;;;;;;;;;;;OAWG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,KAAK,EAAE,UAAU,CAAA;CACjB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,CAAA;AAErD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,KAA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