@mailwoman/zoning 9.4.0 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +169 -163
- package/lib/index.ts +89 -120
- package/lib/paths.ts +24 -0
- package/lib/ring-roles.ts +30 -71
- package/lib/rings.ts +2 -13
- package/lib/schema.ts +96 -114
- package/lib/vocabulary.ts +52 -130
- package/out/index.d.ts +75 -95
- package/out/index.d.ts.map +1 -1
- package/out/index.js +25 -82
- 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/ring-roles.d.ts +16 -50
- package/out/ring-roles.d.ts.map +1 -1
- package/out/ring-roles.js +18 -51
- package/out/ring-roles.js.map +1 -1
- package/out/rings.d.ts +2 -13
- package/out/rings.d.ts.map +1 -1
- package/out/rings.js +2 -13
- package/out/rings.js.map +1 -1
- package/out/schema.d.ts +93 -108
- package/out/schema.d.ts.map +1 -1
- package/out/schema.js +16 -44
- package/out/schema.js.map +1 -1
- package/out/sdk/build-zoning.d.ts +58 -111
- package/out/sdk/build-zoning.d.ts.map +1 -1
- package/out/sdk/build-zoning.js +48 -137
- package/out/sdk/build-zoning.js.map +1 -1
- package/out/sdk/cells.d.ts +20 -61
- package/out/sdk/cells.d.ts.map +1 -1
- package/out/sdk/cells.js +13 -50
- package/out/sdk/cells.js.map +1 -1
- package/out/sdk/client.d.ts +23 -67
- package/out/sdk/client.d.ts.map +1 -1
- package/out/sdk/client.js +29 -77
- package/out/sdk/client.js.map +1 -1
- package/out/sdk/download.d.ts +7 -27
- package/out/sdk/download.d.ts.map +1 -1
- package/out/sdk/download.js +7 -27
- package/out/sdk/download.js.map +1 -1
- package/out/sdk/ingest/chunk.d.ts +106 -0
- package/out/sdk/ingest/chunk.d.ts.map +1 -0
- package/out/sdk/{ingest-chunk.js → ingest/chunk.js} +17 -50
- package/out/sdk/ingest/chunk.js.map +1 -0
- 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} +5 -7
- package/out/sdk/ingest/worker.js.map +1 -0
- package/out/sdk/ingest.d.ts +54 -77
- package/out/sdk/ingest.d.ts.map +1 -1
- package/out/sdk/ingest.js +50 -87
- package/out/sdk/ingest.js.map +1 -1
- package/out/sdk/measure-resolutions.d.ts +6 -23
- package/out/sdk/measure-resolutions.d.ts.map +1 -1
- package/out/sdk/measure-resolutions.js +4 -21
- package/out/sdk/measure-resolutions.js.map +1 -1
- package/out/sdk/test-kit.d.ts +75 -0
- package/out/sdk/test-kit.d.ts.map +1 -0
- package/out/{test-kit.js → sdk/test-kit.js} +20 -43
- package/out/sdk/test-kit.js.map +1 -0
- package/out/sdk/verify.d.ts +74 -56
- package/out/sdk/verify.d.ts.map +1 -1
- package/out/sdk/verify.js +70 -57
- package/out/sdk/verify.js.map +1 -1
- package/out/vocabulary.d.ts +52 -120
- package/out/vocabulary.d.ts.map +1 -1
- package/out/vocabulary.js +47 -125
- package/out/vocabulary.js.map +1 -1
- package/package.json +37 -161
- package/{lib/sdk → sdk}/build-zoning.ts +100 -186
- package/{lib/sdk → sdk}/cells.ts +24 -63
- package/{lib/sdk → sdk}/client.ts +34 -82
- package/sdk/download.ts +58 -0
- package/{lib/sdk/ingest-chunk.ts → sdk/ingest/chunk.ts} +32 -61
- package/{lib/scripts/ingest-chunk.ts → sdk/ingest/worker.ts} +4 -6
- package/sdk/ingest.ts +366 -0
- package/{lib/sdk → sdk}/measure-resolutions.ts +8 -25
- package/{lib → sdk}/test-kit.ts +20 -43
- package/{lib/sdk → sdk}/verify.ts +102 -75
- package/lib/sdk/download.ts +0 -78
- package/lib/sdk/index.ts +0 -15
- package/lib/sdk/ingest.ts +0 -398
- 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 -15
- package/out/sdk/index.d.ts.map +0 -1
- package/out/sdk/index.js +0 -15
- package/out/sdk/index.js.map +0 -1
- package/out/sdk/ingest-chunk.d.ts +0 -130
- package/out/sdk/ingest-chunk.d.ts.map +0 -1
- package/out/sdk/ingest-chunk.js.map +0 -1
- package/out/test-kit.d.ts +0 -96
- package/out/test-kit.d.ts.map +0 -1
- package/out/test-kit.js.map +0 -1
package/out/sdk/ingest.js
CHANGED
|
@@ -3,65 +3,35 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* Streams the Department's bulk zoning export through ogr2ogr as reprojected WGS84 features.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* THE STREAM IS WKT, NOT GEOJSON, AND THAT IS A CORRECTNESS CHOICE RATHER THAN A TASTE ONE. This service
|
|
12
|
-
* encodes hole roles by ring ORIENTATION — clockwise exterior, the inverse of RFC 7946 — and puts each ring
|
|
13
|
-
* in its own `MultiPolygon` part on the features that carry holes that way. GDAL's GeoJSON writer enforces
|
|
14
|
-
* the RFC 7946 winding unconditionally: `-lco RFC7946=NO` is not a GeoJSONSeq option, and
|
|
15
|
-
* `--config OGR_ORGANIZE_POLYGONS SKIP` changes nothing. Measured on the largest feature in the country,
|
|
16
|
-
* Meath's `RA - Rural Area`: through GeoJSONSeq it arrives as 107 counter-clockwise rings totalling
|
|
17
|
-
* 2,371.9 km², through CSV/WKT as the source's own 5 clockwise and 102 counter-clockwise totalling
|
|
18
|
-
* 2,223.1 km² against the Department's published 2,232.1 km². The GeoJSON path has silently turned 102
|
|
19
|
-
* holes into 102 zoned areas.
|
|
20
|
-
*
|
|
21
|
-
* AND THE TRANSPORT IS NOT THE SLOW HALF. Measured on this lab over the whole national export: ogr2ogr
|
|
22
|
-
* reprojects to 224,066,621 bytes of WKT CSV in 13.2 s, and `CSVSpliterator` plus the WKT parse reads
|
|
23
|
-
* 85,330 rows, 93,483 rings and 6,327,256 positions back out of it in 2.2 s.
|
|
24
|
-
*
|
|
25
|
-
* THE SOURCE IS NOT IN WGS84 AND SAYING SO IS THE CHECK. The bulk export is IRENET95 / Irish Transverse
|
|
26
|
-
* Mercator — metres, easting/northing, EPSG:2157 — declared in a top-level `crs` member RFC 7946 removed
|
|
27
|
-
* from the format. GDAL honours the legacy member; a strict reader ignores it and places Ireland's zoning
|
|
28
|
-
* at latitude 735,435. So the projection is asserted against the source's declared authority code before a
|
|
29
|
-
* single feature is read, and every reprojected vertex is asserted inside the Department's own declared
|
|
30
|
-
* extent — which is the check that catches a coordinate-order mistake the projection check cannot see.
|
|
31
|
-
*
|
|
32
|
-
* THE DATUM SHIFT NEEDS A GRID, AND ITS ABSENCE IS SILENT. PROJ substitutes a ballpark offset when the
|
|
33
|
-
* accurate transformation is unavailable and produces coordinates that are metres wrong and
|
|
34
|
-
* indistinguishable from correct ones. {@linkcode assertDatumTransformationAvailable} asks `projinfo` what
|
|
35
|
-
* PROJ would choose and refuses a ballpark; for this source it names
|
|
36
|
-
* `Inverse of Irish Transverse Mercator + IRENET95 to WGS 84 (1), 1 m`.
|
|
37
|
-
*
|
|
38
|
-
* THE PUBLISHER'S OWN AREA COLUMN IS NOT IN THE ARCHIVE. `Shape__Area` is a service field and the export
|
|
39
|
-
* drops it, so the area cross-check reads it from the live service instead — which makes it a genuine
|
|
40
|
-
* two-path check rather than the archive agreeing with itself. See `sdk/client.ts`.
|
|
8
|
+
* The stream uses CSV with WKT geometry because the source marks holes by ring orientation. GDAL's
|
|
9
|
+
* GeoJSON writer rewinds every ring to RFC 7946 order. That turns holes into zoned areas. The source is
|
|
10
|
+
* in EPSG:2157, declared in a legacy top-level `crs` member that GDAL honors.
|
|
41
11
|
*/
|
|
42
12
|
import { declaredFeatureCount } from "@mailwoman/core/layers";
|
|
43
13
|
import { assertRingsInsideExtent, requireArealPolygons } from "@mailwoman/spatial";
|
|
44
14
|
import { readOGRLayerIdentity } from "@mailwoman/spatial/tools/ogr";
|
|
45
|
-
import { spawnOGR2OGR } from "@mailwoman/spatial/tools/ogr
|
|
15
|
+
import { spawnOGR2OGR } from "@mailwoman/spatial/tools/ogr/stream";
|
|
46
16
|
import { wellKnownGeometryToGeoJSON } from "@mailwoman/spatial/well-known-text";
|
|
47
17
|
import { CSVSpliterator } from "spliterator";
|
|
48
18
|
import { resolveRingRoles } from "#rings";
|
|
49
19
|
import { GZT_DECLARED_BBOX, GZT_SOURCE_EPSG } from "#vocabulary";
|
|
50
20
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
21
|
+
* The number of coordinate decimals that ogr2ogr writes.
|
|
22
|
+
* Nine decimals is far finer than the source's precision.
|
|
53
23
|
*/
|
|
54
24
|
const COORDINATE_PRECISION = 9;
|
|
55
25
|
/**
|
|
56
|
-
*
|
|
26
|
+
* The distance in degrees that a vertex may fall outside the declared extent.
|
|
57
27
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
28
|
+
* The published extent is rounded, so an exact test would fail on valid data.
|
|
29
|
+
* An unprojected or axis-swapped read lands much farther away and still fails.
|
|
60
30
|
*/
|
|
61
31
|
const BBOX_MARGIN_DEGREES = 0.01;
|
|
62
32
|
/**
|
|
63
|
-
* The attribute columns the ingest reads.
|
|
64
|
-
*
|
|
33
|
+
* The attribute columns that the ingest reads.
|
|
34
|
+
* Every column is required.
|
|
65
35
|
*/
|
|
66
36
|
export const ZONING_SOURCE_FIELDS = [
|
|
67
37
|
"OBJECTID",
|
|
@@ -81,10 +51,10 @@ export const ZONING_SOURCE_FIELDS = [
|
|
|
81
51
|
"SZO",
|
|
82
52
|
];
|
|
83
53
|
/**
|
|
84
|
-
*
|
|
54
|
+
* Reads the source's declared projection, feature count and field list.
|
|
85
55
|
*
|
|
86
|
-
* @throws {Error} When the export is unreadable, its declared EPSG
|
|
87
|
-
*
|
|
56
|
+
* @throws {Error} When the export is unreadable, when its declared EPSG code differs
|
|
57
|
+
* from `expectEPSG`, or when it lacks a field that the ingest reads.
|
|
88
58
|
*/
|
|
89
59
|
export async function readZoningSourceIdentity(options) {
|
|
90
60
|
const identity = await readOGRLayerIdentity({
|
|
@@ -94,16 +64,15 @@ export async function readZoningSourceIdentity(options) {
|
|
|
94
64
|
areaOfUse: "Ireland",
|
|
95
65
|
});
|
|
96
66
|
const missing = ZONING_SOURCE_FIELDS.filter((field) => field !== "OBJECTID" && !identity.fields.has(field));
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
// nothing. Refused here instead, by name.
|
|
67
|
+
// Given a missing column, `-select` makes ogr2ogr write an empty column without an error.
|
|
68
|
+
// This check turns a source schema change into an error that lists the missing columns.
|
|
100
69
|
if (missing.length) {
|
|
101
70
|
throw new Error(`zoning ingest: ${options.exportPath} carries no ${missing.join(", ")} column(s) — ogr2ogr writes a missing column as empty rather than refusing, so a schema change would arrive as a stream of blank codes`);
|
|
102
71
|
}
|
|
103
72
|
return { epsg: identity.epsg, featureCount: identity.featureCount, layer: identity.layer, fields: identity.fields };
|
|
104
73
|
}
|
|
105
74
|
/**
|
|
106
|
-
*
|
|
75
|
+
* Returns the `-where` arguments for a bounded chunk or a one-authority smoke run.
|
|
107
76
|
*/
|
|
108
77
|
function whereClause(options) {
|
|
109
78
|
const bounds = [];
|
|
@@ -119,8 +88,7 @@ function whereClause(options) {
|
|
|
119
88
|
return bounds.length ? ["-where", bounds.join(" AND ")] : [];
|
|
120
89
|
}
|
|
121
90
|
/**
|
|
122
|
-
*
|
|
123
|
-
* this layer exists to repeat: a blank one is refused by the ingest rather than stored.
|
|
91
|
+
* Returns the value, or null when it is undefined or empty.
|
|
124
92
|
*/
|
|
125
93
|
function blankToNull(value) {
|
|
126
94
|
if (value === undefined)
|
|
@@ -128,13 +96,13 @@ function blankToNull(value) {
|
|
|
128
96
|
return value.length ? value : null;
|
|
129
97
|
}
|
|
130
98
|
/**
|
|
131
|
-
*
|
|
99
|
+
* Streams the export through ogr2ogr as reprojected WKT and checks every vertex against the declared extent.
|
|
132
100
|
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
101
|
+
* The extent check catches swapped coordinate axes.
|
|
102
|
+
* The projection check misses that error.
|
|
135
103
|
*
|
|
136
|
-
* @throws {Error} When ogr2ogr fails, when a feature
|
|
137
|
-
*
|
|
104
|
+
* @throws {Error} When ogr2ogr fails, when a feature has no geometry or a blank local code, when
|
|
105
|
+
* a reprojected vertex falls outside the declared extent, or when a feature's rings have no exterior.
|
|
138
106
|
*/
|
|
139
107
|
export async function* readZoningFeatures(options) {
|
|
140
108
|
const [minLon, minLat, maxLon, maxLat] = options.declaredBBox ?? GZT_DECLARED_BBOX;
|
|
@@ -158,46 +126,39 @@ export async function* readZoningFeatures(options) {
|
|
|
158
126
|
];
|
|
159
127
|
const proc = spawnOGR2OGR(args, "zoning ingest");
|
|
160
128
|
try {
|
|
161
|
-
for await (const row of CSVSpliterator.fromAsync(proc.stdout
|
|
162
|
-
|
|
163
|
-
// Opt-in end-to-end quoting: the WKT column carries commas and spaces on every row, so a reader without it
|
|
164
|
-
// mis-splits every feature into hundreds of columns.
|
|
165
|
-
enableQuoteHandling: true,
|
|
166
|
-
})) {
|
|
167
|
-
const areaID = row.OBJECTID ?? "";
|
|
129
|
+
for await (const row of CSVSpliterator.fromAsync(proc.stdout)) {
|
|
130
|
+
const areaID = row.objectid ?? "";
|
|
168
131
|
if (!areaID) {
|
|
169
132
|
throw new Error("zoning ingest: a row carries no OBJECTID — the authority's own key is the artifact's key");
|
|
170
133
|
}
|
|
171
|
-
const wkt = row.
|
|
134
|
+
const wkt = row.wkt;
|
|
172
135
|
if (!wkt) {
|
|
173
136
|
throw new Error(`zoning ingest: feature ${areaID} carries no geometry`);
|
|
174
137
|
}
|
|
175
138
|
const polygons = normalizePolygons(wkt, `feature ${areaID}`);
|
|
176
139
|
assertRingsInsideExtent(polygons, `feature ${areaID}`, { minLon, minLat, maxLon, maxLat }, BBOX_MARGIN_DEGREES, "zoning ingest");
|
|
177
|
-
const localCode = row.
|
|
178
|
-
// The
|
|
179
|
-
|
|
180
|
-
if (!localCode.trim()) {
|
|
140
|
+
const localCode = row.zone_orig ?? "";
|
|
141
|
+
// The authority never publishes a zone without a code, so a blank code is an error.
|
|
142
|
+
if (!localCode) {
|
|
181
143
|
throw new Error(`zoning ingest: feature ${areaID} carries a blank ZONE_ORIG — the authority's own code is the claim, so a blank is refused rather than stored`);
|
|
182
144
|
}
|
|
183
145
|
yield {
|
|
184
146
|
areaID,
|
|
185
|
-
authorityCode: row.
|
|
186
|
-
authorityName: row.
|
|
187
|
-
planID: row.
|
|
188
|
-
planName: row.
|
|
189
|
-
planLevel: row.
|
|
190
|
-
planFrom: blankToNull(row.
|
|
191
|
-
planTo: blankToNull(row.
|
|
192
|
-
currentPlan: Number(row.
|
|
193
|
-
//
|
|
194
|
-
// five of the 581 distinct strings collide with another only on case or that space.
|
|
147
|
+
authorityCode: row.la_code ?? "",
|
|
148
|
+
authorityName: row.la_name ?? "",
|
|
149
|
+
planID: row.plan_id ?? "",
|
|
150
|
+
planName: row.plan_name ?? "",
|
|
151
|
+
planLevel: row.plan_level ?? "",
|
|
152
|
+
planFrom: blankToNull(row.plan_from),
|
|
153
|
+
planTo: blankToNull(row.plan_to),
|
|
154
|
+
currentPlan: Number(row.current_plan ?? 0),
|
|
155
|
+
// The code stays untrimmed because some distinct codes differ only by case or a trailing space.
|
|
195
156
|
localCode,
|
|
196
|
-
localDescription: blankToNull(row.
|
|
197
|
-
localCodeURL: blankToNull(row.
|
|
198
|
-
crosswalkCode: blankToNull(row.
|
|
199
|
-
crosswalkDescription: blankToNull(row.
|
|
200
|
-
crosswalkRollup: blankToNull(row.
|
|
157
|
+
localDescription: blankToNull(row.zone_desc),
|
|
158
|
+
localCodeURL: blankToNull(row.zone_link),
|
|
159
|
+
crosswalkCode: blankToNull(row.zone_gzt),
|
|
160
|
+
crosswalkDescription: blankToNull(row.gzt_desc),
|
|
161
|
+
crosswalkRollup: blankToNull(row.szo),
|
|
201
162
|
rings: resolveRingRoles(polygons, areaID),
|
|
202
163
|
};
|
|
203
164
|
}
|
|
@@ -208,7 +169,7 @@ export async function* readZoningFeatures(options) {
|
|
|
208
169
|
await proc.settled;
|
|
209
170
|
}
|
|
210
171
|
/**
|
|
211
|
-
*
|
|
172
|
+
* Parses one WKT geometry into `MultiPolygon` rings.
|
|
212
173
|
*
|
|
213
174
|
* @throws {Error} When the geometry is neither a `Polygon` nor a `MultiPolygon`.
|
|
214
175
|
*/
|
|
@@ -217,13 +178,15 @@ function normalizePolygons(wkt, label) {
|
|
|
217
178
|
return requireArealPolygons(geometry, label, "zoning ingest");
|
|
218
179
|
}
|
|
219
180
|
/**
|
|
220
|
-
*
|
|
181
|
+
* Creates a {@link ZoningFeatureSource} for the bulk export.
|
|
182
|
+
*
|
|
183
|
+
* It reads the export's identity immediately and streams features when asked.
|
|
221
184
|
*/
|
|
222
185
|
export async function createExportFeatureSource(options) {
|
|
223
186
|
const identity = await readZoningSourceIdentity(options);
|
|
224
187
|
return {
|
|
225
|
-
//
|
|
226
|
-
//
|
|
188
|
+
// The caller supplies the count for a range or one authority, because
|
|
189
|
+
// `ogrinfo` reports only the layer's total.
|
|
227
190
|
declaredFeatureCount: declaredFeatureCount({
|
|
228
191
|
declared: options.declaredFeatureCount,
|
|
229
192
|
limit: options.limit,
|
package/out/sdk/ingest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingest.js","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"ingest.js","sourceRoot":"","sources":["../../sdk/ingest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAA0B,MAAM,oBAAoB,CAAA;AAC1G,OAAO,EAAE,oBAAoB,E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W,EAAE,KAAa;IACpD,MAAM,QAAQ,GAAG,0BAA0B,CAAyC,GAAG,CAAC,CAAA;IAExF,OAAO,oBAAoB,CAAC,QAAQ,EAAE,KAAK,EAAE,eAAe,CAAC,CAAA;AAC9D,CAAC;AA8BD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,OAA4B;IAC3E,MAAM,QAAQ,GAAG,MAAM,wBAAwB,CAAC,OAAO,CAAC,CAAA;IAExD,OAAO;QACN,sEAAsE;QACtE,4CAA4C;QAC5C,oBAAoB,EAAE,oBAAoB,CAAC;YAC1C,QAAQ,EAAE,OAAO,CAAC,oBAAoB;YACtC,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,UAAU,EAAE,QAAQ,CAAC,YAAY;SACjC,CAAC;QACF,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM,EAAE,OAAO,CAAC,UAAU;QAC1B,QAAQ,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC;KAC3C,CAAA;AACF,CAAC"}
|
|
@@ -3,39 +3,23 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* The
|
|
7
|
-
* inherited size contract's own statistic is not the one that decides it.
|
|
8
|
-
*
|
|
9
|
-
* THE `partial` SHARE CARRIES NO SIGNAL HERE, AND THAT WAS MEASURED. Computed over all 85,330 Irish
|
|
10
|
-
* features, the median zoning polygon is 4,497 m² against an average res-9 cell of 105,333 m²: 95.7% of
|
|
11
|
-
* them are smaller than a res-9 cell, 75.1% smaller than a res-10 cell and 34.5% smaller than a res-11 one.
|
|
12
|
-
* So the `partial` share sits near 100% at every candidate and cannot choose between them.
|
|
13
|
-
*
|
|
14
|
-
* TWO NUMBERS CAN. CANDIDATES PER CELL is what a probe pays — a cell naming eight polygons is eight
|
|
15
|
-
* bounding-box tests and up to eight ray casts — and the POLYFILL-ONLY ZERO-CELL COUNT is how many features
|
|
16
|
-
* the obvious index would have dropped, each of which would read downstream as an absence of zoning. Both
|
|
17
|
-
* are reported per resolution and the `partial` share rides beside them.
|
|
18
|
-
*
|
|
19
|
-
* ONE STREAM, EVERY RESOLUTION. Re-reading the export per candidate costs a full pass each and buys
|
|
20
|
-
* nothing — the classification is per feature, so every candidate index folds the same feature in turn. The
|
|
21
|
-
* cost is memory: each resolution holds its own cell sets, and the finest candidate dominates. A caller that
|
|
22
|
-
* runs out of headroom runs the candidates in separate invocations.
|
|
6
|
+
* The `partial` share cannot choose between candidate resolutions, so each is reported by candidates per cell and by the polyfill-only zero-cell count.
|
|
23
7
|
*/
|
|
24
8
|
import type { ResolutionMeasurementOptions } from "@mailwoman/core/layers";
|
|
25
9
|
import { type CellIndexMeasurement } from "#sdk/cells";
|
|
26
10
|
import { type ZoningIngestOptions } from "#sdk/ingest";
|
|
27
11
|
export interface MeasureResolutionsOptions extends ZoningIngestOptions, ResolutionMeasurementOptions {
|
|
28
12
|
/**
|
|
29
|
-
* Also
|
|
30
|
-
*
|
|
31
|
-
* feature.
|
|
13
|
+
* Also runs a center-in-polygon polyfill per feature per resolution at the
|
|
14
|
+
* cost of one extra h3 call per feature.
|
|
32
15
|
*/
|
|
33
16
|
measurePolyfill?: boolean;
|
|
34
17
|
}
|
|
35
18
|
export interface ResolutionMeasurementReport {
|
|
36
19
|
features: number;
|
|
37
20
|
/**
|
|
38
|
-
* The count the source declares for itself.
|
|
21
|
+
* The count the source declares for itself.
|
|
22
|
+
* A run whose streamed total differs read a truncated file.
|
|
39
23
|
*/
|
|
40
24
|
declaredFeatureCount: number;
|
|
41
25
|
measurements: CellIndexMeasurement[];
|
|
@@ -43,8 +27,7 @@ export interface ResolutionMeasurementReport {
|
|
|
43
27
|
/**
|
|
44
28
|
* Measure every candidate resolution over the real source.
|
|
45
29
|
*
|
|
46
|
-
* @throws {Error} When the streamed feature count does not match the count the source declares.
|
|
47
|
-
* well-formed table describing a smaller country, which is the partial result that must throw.
|
|
30
|
+
* @throws {Error} When the streamed feature count does not match the count the source declares.
|
|
48
31
|
*/
|
|
49
32
|
export declare function measureZoningCellResolutions(options: MeasureResolutionsOptions): Promise<ResolutionMeasurementReport>;
|
|
50
33
|
export { formatResolutionRows } from "#sdk/cells";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measure-resolutions.d.ts","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"measure-resolutions.d.ts","sourceRoot":"","sources":["../../sdk/measure-resolutions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAA;AAG1E,OAAO,EAAyC,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAC7F,OAAO,EAAgD,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEpG,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB,EAAE,4BAA4B;IACnG;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,2BAA2B;IAC3C,QAAQ,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,oBAAoB,EAAE,MAAM,CAAA;IAC5B,YAAY,EAAE,oBAAoB,EAAE,CAAA;CACpC;AAID;;;;GAIG;AACH,wBAAsB,4BAA4B,CACjD,OAAO,EAAE,yBAAyB,GAChC,OAAO,CAAC,2BAA2B,CAAC,CAwCtC;AAED,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -3,23 +3,7 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* The
|
|
7
|
-
* inherited size contract's own statistic is not the one that decides it.
|
|
8
|
-
*
|
|
9
|
-
* THE `partial` SHARE CARRIES NO SIGNAL HERE, AND THAT WAS MEASURED. Computed over all 85,330 Irish
|
|
10
|
-
* features, the median zoning polygon is 4,497 m² against an average res-9 cell of 105,333 m²: 95.7% of
|
|
11
|
-
* them are smaller than a res-9 cell, 75.1% smaller than a res-10 cell and 34.5% smaller than a res-11 one.
|
|
12
|
-
* So the `partial` share sits near 100% at every candidate and cannot choose between them.
|
|
13
|
-
*
|
|
14
|
-
* TWO NUMBERS CAN. CANDIDATES PER CELL is what a probe pays — a cell naming eight polygons is eight
|
|
15
|
-
* bounding-box tests and up to eight ray casts — and the POLYFILL-ONLY ZERO-CELL COUNT is how many features
|
|
16
|
-
* the obvious index would have dropped, each of which would read downstream as an absence of zoning. Both
|
|
17
|
-
* are reported per resolution and the `partial` share rides beside them.
|
|
18
|
-
*
|
|
19
|
-
* ONE STREAM, EVERY RESOLUTION. Re-reading the export per candidate costs a full pass each and buys
|
|
20
|
-
* nothing — the classification is per feature, so every candidate index folds the same feature in turn. The
|
|
21
|
-
* cost is memory: each resolution holds its own cell sets, and the finest candidate dominates. A caller that
|
|
22
|
-
* runs out of headroom runs the candidates in separate invocations.
|
|
6
|
+
* The `partial` share cannot choose between candidate resolutions, so each is reported by candidates per cell and by the polyfill-only zero-cell count.
|
|
23
7
|
*/
|
|
24
8
|
import { classifyFeatureCells } from "@mailwoman/spatial";
|
|
25
9
|
import { polyfillFindsNothing, ZoningCellIndex } from "#sdk/cells";
|
|
@@ -28,8 +12,7 @@ const DEFAULT_PROGRESS_EVERY = 5000;
|
|
|
28
12
|
/**
|
|
29
13
|
* Measure every candidate resolution over the real source.
|
|
30
14
|
*
|
|
31
|
-
* @throws {Error} When the streamed feature count does not match the count the source declares.
|
|
32
|
-
* well-formed table describing a smaller country, which is the partial result that must throw.
|
|
15
|
+
* @throws {Error} When the streamed feature count does not match the count the source declares.
|
|
33
16
|
*/
|
|
34
17
|
export async function measureZoningCellResolutions(options) {
|
|
35
18
|
const identity = await readZoningSourceIdentity(options);
|
|
@@ -49,8 +32,8 @@ export async function measureZoningCellResolutions(options) {
|
|
|
49
32
|
options.onProgress?.(`${features.toLocaleString()} features classified`);
|
|
50
33
|
}
|
|
51
34
|
}
|
|
52
|
-
// A
|
|
53
|
-
//
|
|
35
|
+
// A range or authority selector narrows the population on purpose,
|
|
36
|
+
// so the declared total is only checked on a whole pass.
|
|
54
37
|
const narrowed = options.limit !== undefined || options.authorityCode !== undefined || options.objectIDFrom !== undefined;
|
|
55
38
|
if (!narrowed && features !== identity.featureCount) {
|
|
56
39
|
throw new Error(`zoning measure: streamed ${features} features, the source declares ${identity.featureCount} — a short read reports a smaller country rather than failing`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measure-resolutions.js","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"measure-resolutions.js","sourceRoot":"","sources":["../../sdk/measure-resolutions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAEzD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAA6B,MAAM,YAAY,CAAA;AAC7F,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAA4B,MAAM,aAAa,CAAA;AAoBpG,MAAM,sBAAsB,GAAG,IAAI,CAAA;AAEnC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CACjD,OAAkC;IAElC,MAAM,QAAQ,GAAG,MAAM,wBAAwB,CAAC,OAAO,CAAC,CAAA;IACxD,MAAM,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,UAAU,CAAC,CAAC,CAAA;IACxF,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,sBAAsB,CAAA;IACrE,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,IAAI,CAAA;IAEvD,IAAI,QAAQ,GAAG,CAAC,CAAA;IAEhB,IAAI,KAAK,EAAE,MAAM,OAAO,IAAI,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;QACzD,KAA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0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `@mailwoman/zoning/test-kit` provides hand-built geometry for fixture tests.
|
|
7
|
+
* It includes zones in two plans over the same ground. It includes a zone with a service-encoded hole.
|
|
8
|
+
* It includes a zone smaller than a cell and a zone the authority states as unzoned.
|
|
9
|
+
*
|
|
10
|
+
* Under this service a clockwise ring is the exterior and a counter-clockwise one is a hole, the inverse of the GeoJSON convention and of every sibling fixture.
|
|
11
|
+
*/
|
|
12
|
+
import { rectangleRing as counterClockwiseRing, reversedRing as clockwiseRing, type MultiPolygonRings } from "@mailwoman/spatial";
|
|
13
|
+
import type { ZoningFeatureSource, ZoningSourceFeature } from "#sdk/ingest";
|
|
14
|
+
/**
|
|
15
|
+
* The exterior ring builder under this service's convention.
|
|
16
|
+
*/
|
|
17
|
+
export declare const exteriorRing: typeof clockwiseRing;
|
|
18
|
+
/**
|
|
19
|
+
* The hole ring builder under this service's convention.
|
|
20
|
+
*/
|
|
21
|
+
export declare const holeRing: typeof counterClockwiseRing;
|
|
22
|
+
/**
|
|
23
|
+
* South-west corner of the fixture world, in the Irish Sea east of Dublin.
|
|
24
|
+
*/
|
|
25
|
+
export declare const FIXTURE_ORIGIN: {
|
|
26
|
+
readonly lon: -5.99;
|
|
27
|
+
readonly lat: 53.3;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Side of a fixture zone in degrees.
|
|
31
|
+
*/
|
|
32
|
+
export declare const FIXTURE_SIDE = 0.01;
|
|
33
|
+
/**
|
|
34
|
+
* The fixture authority's code and name.
|
|
35
|
+
*/
|
|
36
|
+
export declare const FIXTURE_AUTHORITY: {
|
|
37
|
+
readonly code: "Fx";
|
|
38
|
+
readonly name: "Fixture County Council";
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The two plans the fixture set uses, shaped like the real product's, with dates
|
|
42
|
+
* preserved as published in the source's own RFC 1123 form.
|
|
43
|
+
*/
|
|
44
|
+
export declare const FIXTURE_PLANS: {
|
|
45
|
+
readonly development: {
|
|
46
|
+
readonly id: "FX-DP-2024";
|
|
47
|
+
readonly name: "Fixture County Development Plan 2024-2030";
|
|
48
|
+
readonly level: "DP";
|
|
49
|
+
readonly from: "Mon, 01 Jan 2024 00:00:00 GMT";
|
|
50
|
+
readonly to: "Sun, 31 Dec 2030 00:00:00 GMT";
|
|
51
|
+
};
|
|
52
|
+
readonly localArea: {
|
|
53
|
+
readonly id: "FX-LAP-2022";
|
|
54
|
+
readonly name: "Fixture Town Local Area Plan 2022-2028";
|
|
55
|
+
readonly level: "LAP";
|
|
56
|
+
readonly from: "Sat, 01 Jan 2022 00:00:00 GMT";
|
|
57
|
+
readonly to: "Sun, 31 Dec 2028 00:00:00 GMT";
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* One fixture feature, with its rings resolved the way the real ingest resolves them.
|
|
62
|
+
*/
|
|
63
|
+
export declare function fixtureFeature(objectID: number, polygons: MultiPolygonRings, overrides?: Partial<Omit<ZoningSourceFeature, "rings">>): ZoningSourceFeature;
|
|
64
|
+
/**
|
|
65
|
+
* The fixture set has two adjacent zones and one with a service-encoded hole.
|
|
66
|
+
*
|
|
67
|
+
* It has a second plan over the same ground.
|
|
68
|
+
* It has a zone smaller than a cell and a zone the authority states as unzoned.
|
|
69
|
+
*/
|
|
70
|
+
export declare function fixtureFeatures(): ZoningSourceFeature[];
|
|
71
|
+
/**
|
|
72
|
+
* A feature source over an explicit feature list.
|
|
73
|
+
*/
|
|
74
|
+
export declare function fixtureSource(features: ZoningSourceFeature[]): ZoningFeatureSource;
|
|
75
|
+
//# sourceMappingURL=test-kit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-kit.d.ts","sourceRoot":"","sources":["../../sdk/test-kit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACN,aAAa,IAAI,oBAAoB,EACrC,YAAY,IAAI,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@author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* `@mailwoman/zoning/test-kit`
|
|
7
|
-
*
|
|
8
|
-
* authority states as
|
|
6
|
+
* `@mailwoman/zoning/test-kit` provides hand-built geometry for fixture tests.
|
|
7
|
+
* It includes zones in two plans over the same ground. It includes a zone with a service-encoded hole.
|
|
8
|
+
* It includes a zone smaller than a cell and a zone the authority states as unzoned.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
* the observation route's suite lives in another workspace, and a relative import across two TypeScript
|
|
12
|
-
* projects is refused outright (`TS2878`) because the compiled layout would not match the source layout.
|
|
13
|
-
*
|
|
14
|
-
* NO NETWORK AND NO GDAL. The builder takes a {@linkcode ZoningFeatureSource}, so a fixture is a list of
|
|
15
|
-
* features — which is what lets this rung exercise the ring-role resolution, the vocabulary census, the cell
|
|
16
|
-
* classification, the coverage rows, the manifest and the seal on every machine rather than only the ones
|
|
17
|
-
* with ogr2ogr.
|
|
18
|
-
*
|
|
19
|
-
* THE EXTERIOR RING IS THE CLOCKWISE ONE, WHICH IS THE INVERSE OF THE GEOJSON CONVENTION AND OF EVERY
|
|
20
|
-
* SIBLING FIXTURE. `@mailwoman/spatial`'s `rectangleRing` winds counter-clockwise and its `reversedRing`
|
|
21
|
-
* clockwise, so this file aliases them the other way round from the flood and coastal test kits: under this
|
|
22
|
-
* service a clockwise ring is the EXTERIOR and a counter-clockwise one is a HOLE. A fixture that used the
|
|
23
|
-
* sibling naming would build geometry the ingest reads inside-out, and every assertion on it would pass.
|
|
24
|
-
*
|
|
25
|
-
* THE COORDINATES ARE IN THE IRISH SEA east of Dublin — inside the Department's declared extent, so a
|
|
26
|
-
* fixture stays in the coordinate space the product occupies, and clear of every real zoning polygon.
|
|
10
|
+
* Under this service a clockwise ring is the exterior and a counter-clockwise one is a hole, the inverse of the GeoJSON convention and of every sibling fixture.
|
|
27
11
|
*/
|
|
28
12
|
import { rectangleRing as counterClockwiseRing, reversedRing as clockwiseRing, } from "@mailwoman/spatial";
|
|
29
13
|
import { resolveRingRoles } from "#rings";
|
|
30
14
|
import { GZT_SOURCE_EPSG, GZT_UNZONED_LOCAL_CODE } from "#vocabulary";
|
|
31
15
|
/**
|
|
32
|
-
* The exterior ring builder
|
|
16
|
+
* The exterior ring builder under this service's convention.
|
|
33
17
|
*/
|
|
34
18
|
export const exteriorRing = clockwiseRing;
|
|
35
19
|
/**
|
|
36
|
-
* The hole ring builder
|
|
20
|
+
* The hole ring builder under this service's convention.
|
|
37
21
|
*/
|
|
38
22
|
export const holeRing = counterClockwiseRing;
|
|
39
23
|
/**
|
|
@@ -41,20 +25,16 @@ export const holeRing = counterClockwiseRing;
|
|
|
41
25
|
*/
|
|
42
26
|
export const FIXTURE_ORIGIN = { lon: -5.99, lat: 53.3 };
|
|
43
27
|
/**
|
|
44
|
-
* Side of a fixture zone
|
|
45
|
-
* interior AND a real fringe.
|
|
28
|
+
* Side of a fixture zone in degrees.
|
|
46
29
|
*/
|
|
47
30
|
export const FIXTURE_SIDE = 0.01;
|
|
48
31
|
/**
|
|
49
|
-
* The fixture authority and
|
|
32
|
+
* The fixture authority's code and name.
|
|
50
33
|
*/
|
|
51
34
|
export const FIXTURE_AUTHORITY = { code: "Fx", name: "Fixture County Council" };
|
|
52
35
|
/**
|
|
53
|
-
* The two plans the fixture set uses, shaped like the real product's
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* The dates are in the source's own RFC 1123 form, because that is what the export publishes and this layer carries
|
|
57
|
-
* them as published rather than re-formatting them.
|
|
36
|
+
* The two plans the fixture set uses, shaped like the real product's, with dates
|
|
37
|
+
* preserved as published in the source's own RFC 1123 form.
|
|
58
38
|
*/
|
|
59
39
|
export const FIXTURE_PLANS = {
|
|
60
40
|
development: {
|
|
@@ -94,32 +74,30 @@ export function fixtureFeature(objectID, polygons, overrides = {}) {
|
|
|
94
74
|
crosswalkDescription: "Existing residential",
|
|
95
75
|
crosswalkRollup: "RE",
|
|
96
76
|
...overrides,
|
|
97
|
-
//
|
|
98
|
-
// assertion rather than the resolution, and the resolution is the part of this layer no sibling already has.
|
|
77
|
+
// Resolved through the real resolver rather than hand-assembled.
|
|
99
78
|
rings: resolveRingRoles(polygons, String(objectID)),
|
|
100
79
|
};
|
|
101
80
|
}
|
|
102
81
|
/**
|
|
103
|
-
* The fixture set
|
|
104
|
-
* SAME ground as the first; a zone smaller than a cell; and a zone the authority states as unzoned.
|
|
82
|
+
* The fixture set has two adjacent zones and one with a service-encoded hole.
|
|
105
83
|
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
84
|
+
* It has a second plan over the same ground.
|
|
85
|
+
* It has a zone smaller than a cell and a zone the authority states as unzoned.
|
|
108
86
|
*/
|
|
109
87
|
export function fixtureFeatures() {
|
|
110
88
|
const { lon, lat } = FIXTURE_ORIGIN;
|
|
111
89
|
const zoneA = exteriorRing(lon, lat, lon + FIXTURE_SIDE, lat + FIXTURE_SIDE);
|
|
112
90
|
const zoneB = exteriorRing(lon + FIXTURE_SIDE, lat, lon + 2 * FIXTURE_SIDE, lat + FIXTURE_SIDE);
|
|
113
|
-
//
|
|
114
|
-
//
|
|
91
|
+
// The real service encodes the hole as a separate part.
|
|
92
|
+
// It does not nest the hole ring.
|
|
115
93
|
const holed = [
|
|
116
94
|
[exteriorRing(lon, lat + 2 * FIXTURE_SIDE, lon + FIXTURE_SIDE, lat + 3 * FIXTURE_SIDE)],
|
|
117
95
|
[
|
|
118
96
|
holeRing(lon + FIXTURE_SIDE * 0.35, lat + 2 * FIXTURE_SIDE + FIXTURE_SIDE * 0.35, lon + FIXTURE_SIDE * 0.65, lat + 2 * FIXTURE_SIDE + FIXTURE_SIDE * 0.65),
|
|
119
97
|
],
|
|
120
98
|
];
|
|
121
|
-
//
|
|
122
|
-
//
|
|
99
|
+
// Smaller than a res-11 cell, so `polygonToCells` returns no cell and the index must
|
|
100
|
+
// cover it by cell-touches-polygon rather than center-in-polygon.
|
|
123
101
|
const sliver = exteriorRing(lon + 3 * FIXTURE_SIDE, lat, lon + 3 * FIXTURE_SIDE + 0.00005, lat + 0.00005);
|
|
124
102
|
const unzoned = exteriorRing(lon + 4 * FIXTURE_SIDE, lat, lon + 5 * FIXTURE_SIDE, lat + FIXTURE_SIDE);
|
|
125
103
|
const localAreaPlan = FIXTURE_PLANS.localArea;
|
|
@@ -143,7 +121,7 @@ export function fixtureFeatures() {
|
|
|
143
121
|
crosswalkCode: "N1.1",
|
|
144
122
|
crosswalkDescription: "Road",
|
|
145
123
|
}),
|
|
146
|
-
// The authority
|
|
124
|
+
// The authority marks land as unzoned with a code its own domain does not declare.
|
|
147
125
|
fixtureFeature(5, [[unzoned]], {
|
|
148
126
|
localCode: GZT_UNZONED_LOCAL_CODE,
|
|
149
127
|
localDescription: "Unzoned",
|
|
@@ -151,8 +129,7 @@ export function fixtureFeatures() {
|
|
|
151
129
|
crosswalkDescription: null,
|
|
152
130
|
crosswalkRollup: "N/A",
|
|
153
131
|
}),
|
|
154
|
-
// The
|
|
155
|
-
// is the shape that makes the crosswalk non-functional over an (authority, code) pair.
|
|
132
|
+
// The same ground as zone A under a second plan, with the same local code mapped to a different generic type.
|
|
156
133
|
fixtureFeature(6, [[zoneA]], {
|
|
157
134
|
planID: localAreaPlan.id,
|
|
158
135
|
planName: localAreaPlan.name,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-kit.js","sourceRoot":"","sources":["../../sdk/test-kit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACN,aAAa,IAAI,oBAAoB,EACrC,YAAY,IAAI,aAAa,GAE7B,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AAEzC,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAErE;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAA;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,QA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