@mailwoman/zoning 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.
Files changed (101) hide show
  1. package/README.md +169 -163
  2. package/lib/index.ts +103 -135
  3. package/lib/paths.ts +24 -0
  4. package/lib/ring-roles.ts +30 -71
  5. package/lib/rings.ts +2 -13
  6. package/lib/schema.ts +98 -139
  7. package/lib/vocabulary.ts +52 -130
  8. package/out/index.d.ts +81 -101
  9. package/out/index.d.ts.map +1 -1
  10. package/out/index.js +37 -96
  11. package/out/index.js.map +1 -1
  12. package/out/paths.d.ts +19 -0
  13. package/out/paths.d.ts.map +1 -0
  14. package/out/paths.js +21 -0
  15. package/out/paths.js.map +1 -0
  16. package/out/ring-roles.d.ts +16 -50
  17. package/out/ring-roles.d.ts.map +1 -1
  18. package/out/ring-roles.js +18 -51
  19. package/out/ring-roles.js.map +1 -1
  20. package/out/rings.d.ts +2 -13
  21. package/out/rings.d.ts.map +1 -1
  22. package/out/rings.js +2 -13
  23. package/out/rings.js.map +1 -1
  24. package/out/schema.d.ts +90 -132
  25. package/out/schema.d.ts.map +1 -1
  26. package/out/schema.js +17 -45
  27. package/out/schema.js.map +1 -1
  28. package/out/sdk/build-zoning.d.ts +58 -111
  29. package/out/sdk/build-zoning.d.ts.map +1 -1
  30. package/out/sdk/build-zoning.js +50 -139
  31. package/out/sdk/build-zoning.js.map +1 -1
  32. package/out/sdk/cells.d.ts +21 -62
  33. package/out/sdk/cells.d.ts.map +1 -1
  34. package/out/sdk/cells.js +15 -52
  35. package/out/sdk/cells.js.map +1 -1
  36. package/out/sdk/client.d.ts +23 -67
  37. package/out/sdk/client.d.ts.map +1 -1
  38. package/out/sdk/client.js +29 -77
  39. package/out/sdk/client.js.map +1 -1
  40. package/out/sdk/download.d.ts +7 -27
  41. package/out/sdk/download.d.ts.map +1 -1
  42. package/out/sdk/download.js +8 -28
  43. package/out/sdk/download.js.map +1 -1
  44. package/out/sdk/ingest/chunk.d.ts +19 -43
  45. package/out/sdk/ingest/chunk.d.ts.map +1 -1
  46. package/out/sdk/ingest/chunk.js +19 -52
  47. package/out/sdk/ingest/chunk.js.map +1 -1
  48. package/out/sdk/ingest/worker.d.ts +9 -0
  49. package/out/sdk/ingest/worker.d.ts.map +1 -0
  50. package/out/{scripts/ingest-chunk.js → sdk/ingest/worker.js} +8 -10
  51. package/out/sdk/ingest/worker.js.map +1 -0
  52. package/out/sdk/ingest.d.ts +152 -0
  53. package/out/sdk/ingest.d.ts.map +1 -0
  54. package/out/sdk/ingest.js +200 -0
  55. package/out/sdk/ingest.js.map +1 -0
  56. package/out/sdk/measure-resolutions.d.ts +7 -34
  57. package/out/sdk/measure-resolutions.d.ts.map +1 -1
  58. package/out/sdk/measure-resolutions.js +5 -23
  59. package/out/sdk/measure-resolutions.js.map +1 -1
  60. package/out/sdk/test-kit.d.ts +75 -0
  61. package/out/sdk/test-kit.d.ts.map +1 -0
  62. package/out/{test-kit.js → sdk/test-kit.js} +20 -43
  63. package/out/sdk/test-kit.js.map +1 -0
  64. package/out/sdk/verify.d.ts +79 -80
  65. package/out/sdk/verify.d.ts.map +1 -1
  66. package/out/sdk/verify.js +83 -70
  67. package/out/sdk/verify.js.map +1 -1
  68. package/out/vocabulary.d.ts +52 -120
  69. package/out/vocabulary.d.ts.map +1 -1
  70. package/out/vocabulary.js +47 -125
  71. package/out/vocabulary.js.map +1 -1
  72. package/package.json +38 -162
  73. package/{lib/sdk → sdk}/build-zoning.ts +102 -188
  74. package/{lib/sdk → sdk}/cells.ts +27 -66
  75. package/{lib/sdk → sdk}/client.ts +34 -82
  76. package/sdk/download.ts +58 -0
  77. package/{lib/sdk → sdk}/ingest/chunk.ts +36 -65
  78. package/{lib/scripts/ingest-chunk.ts → sdk/ingest/worker.ts} +7 -9
  79. package/sdk/ingest.ts +354 -0
  80. package/sdk/measure-resolutions.ts +72 -0
  81. package/{lib → sdk}/test-kit.ts +21 -44
  82. package/sdk/verify.ts +367 -0
  83. package/lib/sdk/download.ts +0 -78
  84. package/lib/sdk/index.ts +0 -15
  85. package/lib/sdk/ingest/index.ts +0 -393
  86. package/lib/sdk/measure-resolutions.ts +0 -101
  87. package/lib/sdk/verify.ts +0 -357
  88. package/out/scripts/ingest-chunk.d.ts +0 -11
  89. package/out/scripts/ingest-chunk.d.ts.map +0 -1
  90. package/out/scripts/ingest-chunk.js.map +0 -1
  91. package/out/sdk/index.d.ts +0 -15
  92. package/out/sdk/index.d.ts.map +0 -1
  93. package/out/sdk/index.js +0 -15
  94. package/out/sdk/index.js.map +0 -1
  95. package/out/sdk/ingest/index.d.ts +0 -185
  96. package/out/sdk/ingest/index.d.ts.map +0 -1
  97. package/out/sdk/ingest/index.js +0 -232
  98. package/out/sdk/ingest/index.js.map +0 -1
  99. package/out/test-kit.d.ts +0 -96
  100. package/out/test-kit.d.ts.map +0 -1
  101. package/out/test-kit.js.map +0 -1
@@ -1,232 +0,0 @@
1
- /**
2
- * @copyright Sister Software
3
- * @license AGPL-3.0
4
- * @author Teffen Ellis, et al.
5
- *
6
- * Read the Department's bulk export as a stream of WGS84 features, through ogr2ogr.
7
- *
8
- * OGR IS BUILD TOOLING, NEVER A SERVE DEPENDENCY (SCOPE invariant 6). It converts the authority's geometry
9
- * into the structure the runtime probes, and nothing downstream of this module knows GDAL exists.
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`.
41
- */
42
- import { declaredFeatureCount } from "@mailwoman/core/layers";
43
- import { assertRingsInsideExtent, requireArealPolygons } from "@mailwoman/spatial";
44
- import { readOGRLayerIdentity } from "@mailwoman/spatial/tools/ogr";
45
- import { spawnOGR2OGR } from "@mailwoman/spatial/tools/ogr-stream";
46
- import { wellKnownGeometryToGeoJSON } from "@mailwoman/spatial/well-known-text";
47
- import { CSVSpliterator } from "spliterator";
48
- import { resolveRingRoles } from "#rings";
49
- import { GZT_DECLARED_BBOX, GZT_SOURCE_EPSG } from "#vocabulary";
50
- /**
51
- * Coordinate decimals ogr2ogr writes into the stream. Nine is ~0.1 mm at this latitude — far past the source's own
52
- * precision, and chosen so the reprojection contributes nothing measurable to the area cross-check.
53
- */
54
- const COORDINATE_PRECISION = 9;
55
- /**
56
- * How far outside the declared extent a vertex may fall before the ingest refuses.
57
- *
58
- * A declared extent is itself a rounded published value, so an exact test would be brittle; this margin is small enough
59
- * that an unprojected or axis-swapped read — which lands degrees or whole hemispheres away — still fails.
60
- */
61
- const BBOX_MARGIN_DEGREES = 0.01;
62
- /**
63
- * The attribute columns the ingest reads. Every one is required: this product publishes a single schema, and a column
64
- * that vanished would be a product change rather than a variation to absorb.
65
- */
66
- export const ZONING_SOURCE_FIELDS = [
67
- "OBJECTID",
68
- "LA_CODE",
69
- "LA_NAME",
70
- "PLAN_ID",
71
- "PLAN_NAME",
72
- "PLAN_LEVEL",
73
- "PLAN_FROM",
74
- "PLAN_TO",
75
- "CURRENT_PLAN",
76
- "ZONE_ORIG",
77
- "ZONE_DESC",
78
- "ZONE_LINK",
79
- "ZONE_GZT",
80
- "GZT_DESC",
81
- "SZO",
82
- ];
83
- /**
84
- * What the source declares about itself: its authority code, its feature count and its field list.
85
- *
86
- * @throws {Error} When the export is unreadable, its declared EPSG is not `expectEPSG`, or it is missing a field the
87
- * ingest reads.
88
- */
89
- export async function readZoningSourceIdentity(options) {
90
- const identity = await readOGRLayerIdentity({
91
- path: options.exportPath,
92
- expectEPSG: options.expectEPSG ?? GZT_SOURCE_EPSG,
93
- context: "zoning ingest",
94
- areaOfUse: "Ireland",
95
- });
96
- const missing = ZONING_SOURCE_FIELDS.filter((field) => field !== "OBJECTID" && !identity.fields.has(field));
97
- // `-select` on a missing column makes ogr2ogr write an EMPTY column rather than refuse, so a schema change would
98
- // arrive as a stream of nulls: every local code blank, every plan unnamed, and a well-formed artifact describing
99
- // nothing. Refused here instead, by name.
100
- if (missing.length) {
101
- 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
- }
103
- return { epsg: identity.epsg, featureCount: identity.featureCount, layer: identity.layer, fields: identity.fields };
104
- }
105
- /**
106
- * The `-where` predicate for a bounded chunk or a one-authority smoke run.
107
- */
108
- function whereClause(options) {
109
- const bounds = [];
110
- if (options.objectIDFrom !== undefined) {
111
- bounds.push(`OBJECTID >= ${options.objectIDFrom}`);
112
- }
113
- if (options.objectIDTo !== undefined) {
114
- bounds.push(`OBJECTID <= ${options.objectIDTo}`);
115
- }
116
- if (options.authorityCode !== undefined) {
117
- bounds.push(`LA_CODE = '${options.authorityCode.replaceAll("'", "''")}'`);
118
- }
119
- return bounds.length ? ["-where", bounds.join(" AND ")] : [];
120
- }
121
- /**
122
- * A published value, as a string or null. An EMPTY STRING IS NOT NULL HERE for the local code, which is the one column
123
- * this layer exists to repeat: a blank one is refused by the ingest rather than stored.
124
- */
125
- function blankToNull(value) {
126
- if (value === undefined)
127
- return null;
128
- return value.length ? value : null;
129
- }
130
- /**
131
- * Stream the export through ogr2ogr as reprojected WKT, checking every vertex against the declared extent.
132
- *
133
- * A swapped coordinate order survives a projection check — both axes are still numbers in a plausible range — and shows
134
- * up here immediately, before 85,330 polygons are written to the wrong side of the planet.
135
- *
136
- * @throws {Error} When ogr2ogr fails, when a feature carries no geometry, when a reprojected vertex falls outside the
137
- * declared extent, or when a feature's rings cannot be resolved into at least one exterior.
138
- */
139
- export async function* readZoningFeatures(options) {
140
- const [minLon, minLat, maxLon, maxLat] = options.declaredBBox ?? GZT_DECLARED_BBOX;
141
- const args = [
142
- "-f",
143
- "CSV",
144
- "/vsistdout/",
145
- "-t_srs",
146
- "EPSG:4326",
147
- "-lco",
148
- "GEOMETRY=AS_WKT",
149
- "-lco",
150
- "CREATE_CSVT=NO",
151
- "-lco",
152
- `COORDINATE_PRECISION=${COORDINATE_PRECISION}`,
153
- "-select",
154
- ZONING_SOURCE_FIELDS.join(","),
155
- ...whereClause(options),
156
- ...(options.limit === undefined ? [] : ["-limit", String(options.limit)]),
157
- options.exportPath,
158
- ];
159
- const proc = spawnOGR2OGR(args, "zoning ingest");
160
- try {
161
- for await (const row of CSVSpliterator.fromAsync(proc.stdout)) {
162
- const areaID = row.objectid ?? "";
163
- if (!areaID) {
164
- throw new Error("zoning ingest: a row carries no OBJECTID — the authority's own key is the artifact's key");
165
- }
166
- const wkt = row.wkt;
167
- if (!wkt) {
168
- throw new Error(`zoning ingest: feature ${areaID} carries no geometry`);
169
- }
170
- const polygons = normalizePolygons(wkt, `feature ${areaID}`);
171
- assertRingsInsideExtent(polygons, `feature ${areaID}`, { minLon, minLat, maxLon, maxLat }, BBOX_MARGIN_DEGREES, "zoning ingest");
172
- const localCode = row.zone_orig ?? "";
173
- // The local code is what this layer exists to repeat, so a blank one is refused rather than stored: it would read
174
- // as a zone the authority named nothing, which is not a reading the authority ever makes.
175
- if (!localCode.trim()) {
176
- 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`);
177
- }
178
- yield {
179
- areaID,
180
- authorityCode: row.la_code ?? "",
181
- authorityName: row.la_name ?? "",
182
- planID: row.plan_id ?? "",
183
- planName: row.plan_name ?? "",
184
- planLevel: row.plan_level ?? "",
185
- planFrom: blankToNull(row.plan_from),
186
- planTo: blankToNull(row.plan_to),
187
- currentPlan: Number(row.current_plan ?? 0),
188
- // VERBATIM, and deliberately un-trimmed: `Proposed Residential ` carries a trailing space in the source, and
189
- // five of the 581 distinct strings collide with another only on case or that space.
190
- localCode,
191
- localDescription: blankToNull(row.zone_desc),
192
- localCodeURL: blankToNull(row.zone_link),
193
- crosswalkCode: blankToNull(row.zone_gzt),
194
- crosswalkDescription: blankToNull(row.gzt_desc),
195
- crosswalkRollup: blankToNull(row.szo),
196
- rings: resolveRingRoles(polygons, areaID),
197
- };
198
- }
199
- }
200
- finally {
201
- proc.kill();
202
- }
203
- await proc.settled;
204
- }
205
- /**
206
- * Parse one WKT geometry into the ring shape the rest of this package works in.
207
- *
208
- * @throws {Error} When the geometry is neither a `Polygon` nor a `MultiPolygon`.
209
- */
210
- function normalizePolygons(wkt, label) {
211
- const geometry = wellKnownGeometryToGeoJSON(wkt);
212
- return requireArealPolygons(geometry, label, "zoning ingest");
213
- }
214
- /**
215
- * The bulk export as a feature source — identity read up front, features streamed on demand.
216
- */
217
- export async function createExportFeatureSource(options) {
218
- const identity = await readZoningSourceIdentity(options);
219
- return {
220
- // A RANGE's or an authority's own count is supplied by the caller, because `ogrinfo` reports a layer's total and
221
- // nothing narrower.
222
- declaredFeatureCount: declaredFeatureCount({
223
- declared: options.declaredFeatureCount,
224
- limit: options.limit,
225
- layerCount: identity.featureCount,
226
- }),
227
- epsg: identity.epsg,
228
- origin: options.exportPath,
229
- features: () => readZoningFeatures(options),
230
- };
231
- }
232
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/sdk/ingest/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAA0B,MAAM,oBAAoB,CAAA;AAC1G,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EAAE,gBAAgB,EAA0B,MAAM,QAAQ,CAAA;AACjE,OAAO,EAAE,iB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,KAAK,UAAU,yBAAyB,CAAC,OAA4B;IAC3E,MAAM,QAAQ,GAAG,MAAM,wBAAwB,CAAC,OAAO,CAAC,CAAA;IAExD,OAAO;QACN,iHAAiH;QACjH,oBAAoB;QACpB,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"}
package/out/test-kit.d.ts DELETED
@@ -1,96 +0,0 @@
1
- /**
2
- * @copyright Sister Software
3
- * @license AGPL-3.0
4
- * @author Teffen Ellis, et al.
5
- *
6
- * `@mailwoman/zoning/test-kit` — hand-built geometry for the fixture rung: zones in two plans over the same
7
- * ground, one with a hole encoded the way this service encodes them, one smaller than a cell, and one the
8
- * authority states as UNZONED.
9
- *
10
- * A PACKAGE SUBPATH RATHER THAN A `test/` FILE, for the same reason `packages/mailwoman/lib/test-kit` is one:
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.
27
- */
28
- import { rectangleRing as counterClockwiseRing, reversedRing as clockwiseRing, type MultiPolygonRings } from "@mailwoman/spatial";
29
- import type { ZoningFeatureSource, ZoningSourceFeature } from "#sdk/ingest/index";
30
- /**
31
- * The exterior ring builder, under THIS service's convention. Clockwise.
32
- */
33
- export declare const exteriorRing: typeof clockwiseRing;
34
- /**
35
- * The hole ring builder, under THIS service's convention. Counter-clockwise.
36
- */
37
- export declare const holeRing: typeof counterClockwiseRing;
38
- /**
39
- * South-west corner of the fixture world, in the Irish Sea east of Dublin.
40
- */
41
- export declare const FIXTURE_ORIGIN: {
42
- readonly lon: -5.99;
43
- readonly lat: 53.3;
44
- };
45
- /**
46
- * Side of a fixture zone, in degrees. About 1.1 km at this latitude — several res-10 cells across, so a zone has a real
47
- * interior AND a real fringe.
48
- */
49
- export declare const FIXTURE_SIDE = 0.01;
50
- /**
51
- * The fixture authority and its two plans.
52
- */
53
- export declare const FIXTURE_AUTHORITY: {
54
- readonly code: "Fx";
55
- readonly name: "Fixture County Council";
56
- };
57
- /**
58
- * The two plans the fixture set uses, shaped like the real product's: a Development Plan and a Local Area Plan, each
59
- * with its own stated window, both able to zone the same ground.
60
- *
61
- * The dates are in the source's own RFC 1123 form, because that is what the export publishes and this layer carries
62
- * them as published rather than re-formatting them.
63
- */
64
- export declare const FIXTURE_PLANS: {
65
- readonly development: {
66
- readonly id: "FX-DP-2024";
67
- readonly name: "Fixture County Development Plan 2024-2030";
68
- readonly level: "DP";
69
- readonly from: "Mon, 01 Jan 2024 00:00:00 GMT";
70
- readonly to: "Sun, 31 Dec 2030 00:00:00 GMT";
71
- };
72
- readonly localArea: {
73
- readonly id: "FX-LAP-2022";
74
- readonly name: "Fixture Town Local Area Plan 2022-2028";
75
- readonly level: "LAP";
76
- readonly from: "Sat, 01 Jan 2022 00:00:00 GMT";
77
- readonly to: "Sun, 31 Dec 2028 00:00:00 GMT";
78
- };
79
- };
80
- /**
81
- * One fixture feature, with its rings resolved the way the real ingest resolves them.
82
- */
83
- export declare function fixtureFeature(objectID: number, polygons: MultiPolygonRings, overrides?: Partial<Omit<ZoningSourceFeature, "rings">>): ZoningSourceFeature;
84
- /**
85
- * The fixture set: two adjacent zones, one of them holed the way this service encodes holes; a second plan over the
86
- * SAME ground as the first; a zone smaller than a cell; and a zone the authority states as unzoned.
87
- *
88
- * THE OVERLAP BETWEEN PLANS IS THE POINT. A point inside the first zone must answer with BOTH rows, each naming its own
89
- * plan — which is what proves a plan is part of the claim rather than a parameter of it.
90
- */
91
- export declare function fixtureFeatures(): ZoningSourceFeature[];
92
- /**
93
- * A feature source over an explicit feature list.
94
- */
95
- export declare function fixtureSource(features: ZoningSourceFeature[]): ZoningFeatureSource;
96
- //# sourceMappingURL=test-kit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-kit.d.ts","sourceRoot":"","sources":["../lib/test-kit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACN,aAAa,IAAI,oBAAoB,EACrC,YAAY,IAAI,aAAa,EAC7B,KAAK,iBAAiB,EACtB,MAAM,oBAAoB,CAAA;AAG3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAGjF;;GAEG;AACH,eAAO,MAAM,YAAY,sBAAgB,CAAA;AAEzC;;GAEG;AACH,eAAO,MAAM,QAAQ,6BAAuB,CAAA;AAE5C;;GAEG;AACH,eAAO,MAAM,cAAc;aAAK,GAAG,EAAE,CAAC,IAAI;aAAE,GAAG,EAAE,IAAI;CAAW,CAAA;AAEhE;;;GAGG;AACH,eAAO,MAAM,YAAY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