@mailwoman/zoning 9.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 (82) hide show
  1. package/README.md +315 -0
  2. package/lib/index.ts +616 -0
  3. package/lib/ring-roles.ts +233 -0
  4. package/lib/rings.ts +34 -0
  5. package/lib/schema.ts +449 -0
  6. package/lib/scripts/ingest-chunk.ts +41 -0
  7. package/lib/sdk/build-zoning.ts +790 -0
  8. package/lib/sdk/cells.ts +276 -0
  9. package/lib/sdk/client.ts +335 -0
  10. package/lib/sdk/download.ts +78 -0
  11. package/lib/sdk/index.ts +15 -0
  12. package/lib/sdk/ingest-chunk.ts +360 -0
  13. package/lib/sdk/ingest.ts +402 -0
  14. package/lib/sdk/measure-resolutions.ts +100 -0
  15. package/lib/sdk/verify.ts +350 -0
  16. package/lib/test-kit.ts +207 -0
  17. package/lib/vocabulary.ts +342 -0
  18. package/out/index.d.ts +257 -0
  19. package/out/index.d.ts.map +1 -0
  20. package/out/index.js +325 -0
  21. package/out/index.js.map +1 -0
  22. package/out/ring-roles.d.ts +88 -0
  23. package/out/ring-roles.d.ts.map +1 -0
  24. package/out/ring-roles.js +151 -0
  25. package/out/ring-roles.js.map +1 -0
  26. package/out/rings.d.ts +22 -0
  27. package/out/rings.d.ts.map +1 -0
  28. package/out/rings.js +22 -0
  29. package/out/rings.js.map +1 -0
  30. package/out/schema.d.ts +325 -0
  31. package/out/schema.d.ts.map +1 -0
  32. package/out/schema.js +186 -0
  33. package/out/schema.js.map +1 -0
  34. package/out/scripts/ingest-chunk.d.ts +11 -0
  35. package/out/scripts/ingest-chunk.d.ts.map +1 -0
  36. package/out/scripts/ingest-chunk.js +36 -0
  37. package/out/scripts/ingest-chunk.js.map +1 -0
  38. package/out/sdk/build-zoning.d.ts +283 -0
  39. package/out/sdk/build-zoning.d.ts.map +1 -0
  40. package/out/sdk/build-zoning.js +462 -0
  41. package/out/sdk/build-zoning.js.map +1 -0
  42. package/out/sdk/cells.d.ts +137 -0
  43. package/out/sdk/cells.d.ts.map +1 -0
  44. package/out/sdk/cells.js +176 -0
  45. package/out/sdk/cells.js.map +1 -0
  46. package/out/sdk/client.d.ts +151 -0
  47. package/out/sdk/client.d.ts.map +1 -0
  48. package/out/sdk/client.js +239 -0
  49. package/out/sdk/client.js.map +1 -0
  50. package/out/sdk/download.d.ts +51 -0
  51. package/out/sdk/download.d.ts.map +1 -0
  52. package/out/sdk/download.js +57 -0
  53. package/out/sdk/download.js.map +1 -0
  54. package/out/sdk/index.d.ts +15 -0
  55. package/out/sdk/index.d.ts.map +1 -0
  56. package/out/sdk/index.js +15 -0
  57. package/out/sdk/index.js.map +1 -0
  58. package/out/sdk/ingest-chunk.d.ts +130 -0
  59. package/out/sdk/ingest-chunk.d.ts.map +1 -0
  60. package/out/sdk/ingest-chunk.js +206 -0
  61. package/out/sdk/ingest-chunk.js.map +1 -0
  62. package/out/sdk/ingest.d.ts +191 -0
  63. package/out/sdk/ingest.d.ts.map +1 -0
  64. package/out/sdk/ingest.js +238 -0
  65. package/out/sdk/ingest.js.map +1 -0
  66. package/out/sdk/measure-resolutions.d.ts +51 -0
  67. package/out/sdk/measure-resolutions.d.ts.map +1 -0
  68. package/out/sdk/measure-resolutions.js +64 -0
  69. package/out/sdk/measure-resolutions.js.map +1 -0
  70. package/out/sdk/verify.d.ts +176 -0
  71. package/out/sdk/verify.d.ts.map +1 -0
  72. package/out/sdk/verify.js +202 -0
  73. package/out/sdk/verify.js.map +1 -0
  74. package/out/test-kit.d.ts +97 -0
  75. package/out/test-kit.d.ts.map +1 -0
  76. package/out/test-kit.js +180 -0
  77. package/out/test-kit.js.map +1 -0
  78. package/out/vocabulary.d.ts +221 -0
  79. package/out/vocabulary.d.ts.map +1 -0
  80. package/out/vocabulary.js +299 -0
  81. package/out/vocabulary.js.map +1 -0
  82. package/package.json +245 -0
@@ -0,0 +1,342 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The Department's own words, as data: the product identity, the national generic-type domain it declares,
7
+ * the plan vocabulary, the exclusions it states, and the licence posture that holds this layer at
8
+ * `build-local`.
9
+ *
10
+ * THE LOCAL CODE IS CARRIED VERBATIM AND THE CROSSWALK SITS BESIDE IT, NEVER INSTEAD OF IT. The Department
11
+ * publishes a national generic type over 30 local authorities' own zone codes and says in its own item
12
+ * description that the scheme "complements (rather than replaces) the existing statutory zoning used for
13
+ * each individual plan". So a row carries both: `local_code` as the authority spelled it, and
14
+ * `crosswalk_code` under {@link GZT_CROSSWALK_SCHEME} with its own provenance. Measured over the whole
15
+ * national set, 52 of 795 (authority, local code) pairs take MORE THAN ONE generic type, so the mapping is
16
+ * not a function of the pair and no code table can carry it — which is why `zoning_crosswalk_edge` ships
17
+ * empty and the mapping lives per polygon.
18
+ *
19
+ * THE DECLARED DOMAIN IS CLOSED AND THE SOURCE ALREADY BREAKS IT. The service declares 54 generic types in
20
+ * its own coded-value domain; the data uses 55. `N/A` appears on 4 rows and in no domain. So the ingest
21
+ * carries the declared domain PLUS the values observed in the data and records the difference
22
+ * (`zoning_vocabulary.declared`) rather than coercing an undeclared value to a neighbour or to null —
23
+ * either of which turns "the source changed" into "there is nothing here".
24
+ *
25
+ * `CURRENT_PLAN = 1` DOES NOT MEAN "IN FORCE TODAY". All 85,330 rows in the Current layer carry it, and the
26
+ * domain defines it as `Current plan` against `Expired and not replaced` and `Expired and replaced`. It
27
+ * means "not superseded". The plan's own `PLAN_FROM`/`PLAN_TO` window is a separate fact a consumer must
28
+ * read, and it is carried on `zoning_plan` for that reason.
29
+ *
30
+ * `LA_CODE` IS DIRTY AND IS NEVER REPAIRED. Fingal's code is `Fl` with a lowercase second letter against
31
+ * `CL`, `CO`, `DU` and the rest. It is the publisher's key; repairing it would put this package's spelling
32
+ * into an artifact that claims to repeat the authority's.
33
+ */
34
+
35
+ /**
36
+ * The layer name written into `layer_manifest.name`, and the only name the reader accepts.
37
+ */
38
+ export const GZT_LAYER_NAME = "zoning-ie-gzt"
39
+
40
+ /**
41
+ * The ArcGIS Online item the product is published as, written into `layer_manifest.source`.
42
+ */
43
+ export const GZT_ITEM_ID = "5c2608ebedd84013aaeff8bf669e8596"
44
+
45
+ /**
46
+ * The publishing organisation's ArcGIS Online id.
47
+ */
48
+ export const GZT_ORG_ID = "NzlPQPKn5QF9v2US"
49
+
50
+ /**
51
+ * The feature layer the product is served from.
52
+ */
53
+ export const GZT_SERVICE_URL = `https://services.arcgis.com/${GZT_ORG_ID}/arcgis/rest/services/GZT_Current_Plan/FeatureServer/0`
54
+
55
+ /**
56
+ * The item page, cited wherever a statement of the Department's is quoted.
57
+ */
58
+ export const GZT_ITEM_URL = `https://www.arcgis.com/home/item.html?id=${GZT_ITEM_ID}`
59
+
60
+ /**
61
+ * The Department's own zoning map viewer, which is where its coverage detail is published — and the reason
62
+ * `zoning_mapped_extent` ships empty (see {@link GZT_COVERAGE_LIMIT}).
63
+ */
64
+ export const GZT_MAP_VIEWER_URL = "https://www.myplan.ie/zoning-map-viewer/"
65
+
66
+ /**
67
+ * The attribution the item's `accessInformation` field carries, plus the licensor its `licenseInfo` names.
68
+ *
69
+ * BOTH HALVES RIDE, because the second is the half that holds this layer at `build-local`. The Department's own credit
70
+ * line is the first; the all-rights-reserved clause naming Tailte Éireann as an upstream licensor is the second, and a
71
+ * re-user who saw only the first would not know it exists.
72
+ */
73
+ export const GZT_ATTRIBUTION =
74
+ "Department of Housing, Local Government, and Heritage (Generalised Zoning Types, MyPlan.ie). " +
75
+ "© Copyright 2011 DHLGH. All rights reserved. © Tailte Éireann. All rights reserved. Licence No. 2023/OSi_NMA_073"
76
+
77
+ /**
78
+ * The licence expression written into `layer_manifest.license`.
79
+ *
80
+ * `NOASSERTION` IS THE HONEST VALUE AND IT IS NOT A PLACEHOLDER. Three published statements disagree about the grant —
81
+ * see {@link GZT_LICENSE_CONTRADICTION} — and the manifest column is a string a consumer reads as the terms it may rely
82
+ * on. Writing `CC-BY-4.0` there while an all-rights-reserved clause names a licensor would be this program asserting a
83
+ * grant nobody made; leaving the column empty would read as a layer whose licence nobody looked at. `NOASSERTION` is
84
+ * SPDX's own token for a determination that has not been made, which is exactly the state.
85
+ *
86
+ * {@linkcode assertTierMatchesLicense} refuses a `shipped` build while this holds, so moving the tier takes a
87
+ * deliberate edit at a guard that names the reason rather than a manifest field nobody notices.
88
+ */
89
+ export const GZT_LICENSE = "NOASSERTION"
90
+
91
+ /**
92
+ * Why the licence is unresolved, in one sentence a receipt can carry.
93
+ */
94
+ export const GZT_LICENSE_CONTRADICTION =
95
+ "Three published statements disagree about the grant: data.gov.ie declares CC-BY-4.0; the ArcGIS item's licenseInfo " +
96
+ 'states the Department "aims to publish its data holdings into the future, where possible, as Open Data licensed under ' +
97
+ 'Creative Commons Attribution 4.0" and, in the same field, that copyright "belonging to our licensors (Tailte Éireann) ' +
98
+ "may not be copied, transmitted or reproduced without their prior consent\"; and myplan.ie's own disclaimer grants " +
99
+ "distribution and commercial use while pointing at a map-viewer splash screen for the operative terms. " +
100
+ "A shipped layer needs one grant it can quote, so this one is built locally and never redistributed."
101
+
102
+ /**
103
+ * The projected CRS the service and its bulk export both declare. The source is NOT in WGS84 — it is IRENET95 / Irish
104
+ * Transverse Mercator, in metres — so the ingest reprojects and refuses a source declaring anything else.
105
+ */
106
+ export const GZT_SOURCE_EPSG = 2157
107
+
108
+ /**
109
+ * The extent the Department declares for the item, in CRS84 order `[minLon, minLat, maxLon, maxLat]` — the Republic of
110
+ * Ireland, excluding Northern Ireland.
111
+ *
112
+ * The ingest asserts every reprojected vertex lands inside this. That is the check a projection check cannot make: the
113
+ * bulk export carries Irish Transverse Mercator metres under a legacy `crs` member, so a reader that took the numbers
114
+ * as degrees would place Ireland's zoning at latitude 735,435 — a well-formed set of coordinates in the Southern
115
+ * Ocean.
116
+ */
117
+ export const GZT_DECLARED_BBOX: readonly [number, number, number, number] = [
118
+ -10.54553193079905, 51.452765583177616, -5.947766999109422, 54.47387941831219,
119
+ ]
120
+
121
+ /**
122
+ * The feature count the service's own `returnCountOnly` and the bulk export agree on.
123
+ */
124
+ export const GZT_DECLARED_FEATURE_COUNT = 85_330
125
+
126
+ /**
127
+ * The crosswalk scheme the Department publishes — its national Generalised Zoning Type code.
128
+ */
129
+ export const GZT_CROSSWALK_SCHEME = "IE-GZT"
130
+
131
+ /**
132
+ * The Department's second, coarser national code (`SZO`, Standardised Zoning Objective).
133
+ *
134
+ * Carried as published rather than derived. Measured over the whole national set it is a STRICT COARSENING of the
135
+ * generic type — no generic type maps to more than one `SZO` — but the roll-up is the Department's to change, so
136
+ * re-deriving it here would replace a published fact with this package's arithmetic.
137
+ */
138
+ export const GZT_ROLLUP_SCHEME = "IE-SZO"
139
+
140
+ /**
141
+ * The vocabulary scheme one local authority's own zone codes belong to.
142
+ *
143
+ * PER AUTHORITY RATHER THAN ONE POOLED LOCAL SCHEME, because the codes collide: `Residential` means one thing in Cork
144
+ * County Council's plan and another in Westmeath's, and pooling them would assert an equivalence no authority stated.
145
+ */
146
+ export function localSchemeFor(authorityCode: string): string {
147
+ return `IE-LOCAL:${authorityCode}`
148
+ }
149
+
150
+ /**
151
+ * One value a publisher declares, with the label it publishes for it.
152
+ */
153
+ export interface ZoningTermDefinition {
154
+ /**
155
+ * The code as the publisher spells it — never re-spelled, never normalized.
156
+ */
157
+ code: string
158
+ label: string
159
+ }
160
+
161
+ /**
162
+ * The Department's declared generic-type domain, verbatim from the service's own `GZT Code` coded-value domain.
163
+ *
164
+ * FIFTY-FOUR DECLARED AGAINST FIFTY-FIVE USED. `N/A` appears on 4 of 85,330 rows and in no domain, so the ingest
165
+ * records it as observed-but-undeclared rather than adding it here — a declaration this package wrote would be
166
+ * indistinguishable from one the Department made.
167
+ */
168
+ export const GZT_DECLARED_CODES: ReadonlyArray<ZoningTermDefinition> = [
169
+ { code: "P1", label: "Agriculture" },
170
+ { code: "P2", label: "Forestry" },
171
+ { code: "P3", label: "Aquaculture and fishing" },
172
+ { code: "P4", label: "Quarrying / mining" },
173
+ { code: "P5", label: "Mixed/general primary sector uses, including ‘rural’" },
174
+ { code: "P6", label: "Other primary sector uses" },
175
+ { code: "C1.1", label: "Commercial, retail" },
176
+ { code: "C1.2", label: "Retail warehouse" },
177
+ { code: "C2.1", label: "Industrial, enterprise, employment" },
178
+ { code: "C2.2", label: "General industry" },
179
+ { code: "C3", label: "Office, business/technology park and related" },
180
+ { code: "C4", label: "Warehouse (excluding retail warehouse)" },
181
+ { code: "C5", label: "Tourism and related" },
182
+ { code: "C6", label: "Mixed/general commercial/industrial/enterprise uses" },
183
+ { code: "C7", label: "Other commerce/industrial/enterprise uses" },
184
+ { code: "S1", label: "Education" },
185
+ { code: "S2", label: "Health and related" },
186
+ { code: "S3", label: "Community facilities" },
187
+ { code: "S4", label: "General public administration" },
188
+ { code: "S5", label: "Mixed/general community services/facilities uses" },
189
+ { code: "S6", label: "Other community services/facilities uses" },
190
+ { code: "N1.1", label: "Road" },
191
+ { code: "N1.2", label: "Rail" },
192
+ { code: "N1.3", label: "Airport" },
193
+ { code: "N1.4", label: "Seaport/Harbour" },
194
+ { code: "N1.5", label: "Mixed/general transport uses" },
195
+ { code: "N1.6", label: "Other transport/general uses" },
196
+ { code: "N2.1", label: "Water" },
197
+ { code: "N2.2", label: "Wastewater" },
198
+ { code: "N2.3", label: "Mixed/general water/wastewater uses" },
199
+ { code: "N2.4", label: "Other water/waste water uses" },
200
+ { code: "N3.1", label: "Gas" },
201
+ { code: "N3.2", label: "Electricity" },
202
+ { code: "N3.3", label: "Mixed/general gas and electricity uses" },
203
+ { code: "N3.4", label: "Other gas and electricity uses" },
204
+ { code: "N4", label: "Telecommunications" },
205
+ { code: "N5", label: "Solid waste" },
206
+ { code: "N6", label: "Other networks and basic infrastructure/utilities uses" },
207
+ { code: "R1", label: "New/proposed residential" },
208
+ { code: "R2", label: "Existing residential" },
209
+ { code: "R3", label: "Residential, mixed residential and other uses" },
210
+ { code: "R4", label: "Strategic Residential Reserve" },
211
+ { code: "G1", label: "Open space, park" },
212
+ { code: "G2", label: "Walkway, cycleway, bridle path" },
213
+ { code: "G3", label: "Conservation, amenity or buffer space, corridor/belt, landscape protection" },
214
+ { code: "G4", label: "Active open space" },
215
+ { code: "G5", label: "Mixed/general ‘green’/recreation/conservation, other" },
216
+ { code: "M1", label: "Mixed Use, general development, opportunity/proposal site" },
217
+ { code: "M2", label: "City/Town/village Centre, central area" },
218
+ { code: "M3", label: "District, neighbourhood centre" },
219
+ { code: "M4", label: "Built up area" },
220
+ { code: "M5", label: "Other mix of uses" },
221
+ { code: "O1", label: "Strategic reserve, White land" },
222
+ { code: "O2", label: "General" },
223
+ ]
224
+
225
+ /**
226
+ * The declared generic-type codes as a membership set.
227
+ */
228
+ export const GZT_DECLARED_CODE_SET: ReadonlySet<string> = new Set(GZT_DECLARED_CODES.map((term) => term.code))
229
+
230
+ /**
231
+ * The `PLAN_LEVEL` domain, verbatim. `SDZ` is declared and used on no row of the current edition; it is carried anyway,
232
+ * because the domain is the Department's statement of what a plan may be rather than a census of what it is.
233
+ */
234
+ export const GZT_PLAN_LEVELS: ReadonlyArray<ZoningTermDefinition> = [
235
+ { code: "DP", label: "Development Plan" },
236
+ { code: "LAP", label: "Local Area Plan" },
237
+ { code: "SDZ", label: "Strategic Development Zone" },
238
+ ]
239
+
240
+ /**
241
+ * The `PLAN_LEVEL` domain as a membership set.
242
+ */
243
+ export const GZT_PLAN_LEVEL_SET: ReadonlySet<string> = new Set(GZT_PLAN_LEVELS.map((term) => term.code))
244
+
245
+ /**
246
+ * The `CURRENT_PLAN` domain, verbatim, keyed by the integer the source publishes.
247
+ */
248
+ export const GZT_CURRENT_PLAN_VALUES: ReadonlyMap<number, string> = new Map([
249
+ [1, "Current plan"],
250
+ [2, "Expired and not replaced"],
251
+ [0, "Expired and replaced"],
252
+ ])
253
+
254
+ /**
255
+ * The provenance grade a zoning claim carries. Exactly one per row, and the two never merge.
256
+ *
257
+ * `authoritative` is a planning or legislative authority for the land, or a government body republishing that
258
+ * authority's own adopted records — the Department republishing 30 local authorities' plans is one. `inferred` is an
259
+ * observation, a community mapping project or a research assembly: OpenStreetMap `landuse` is inferred, and so is
260
+ * Overture's `base/land_use`, because it is the same data.
261
+ *
262
+ * NEITHER GRADE IS BETTER; THEY ANSWER DIFFERENT QUESTIONS. The rule is that a query answered from an `inferred` row
263
+ * may never be presented as the authority's designation. Measured in one jurisdiction on one day: of 1,652
264
+ * OpenStreetMap `landuse=residential` polygons in South Dublin, only 558 — 33.8% — sit on land the authority zones
265
+ * residential, and the two largest wrong answers are agriculture (23.4%) and conservation (19.6%).
266
+ *
267
+ * ONE ARTIFACT HOLDS ONE GRADE. An observed land-use layer is a different database with a different
268
+ * `layer_manifest.name`, because `layer_coverage.observed_rows` means "rows this layer actually holds in the cell" and
269
+ * coverage measured over community-mapped polygons cannot describe an authority's zones. The licences make the
270
+ * separation compulsory anyway: OpenStreetMap and Overture `base` are ODbL, and merging an ODbL row into this table
271
+ * would relicense it.
272
+ */
273
+ export const ProvenanceGrade = {
274
+ Authoritative: "authoritative",
275
+ Inferred: "inferred",
276
+ } as const
277
+
278
+ export type ProvenanceGrade = (typeof ProvenanceGrade)[keyof typeof ProvenanceGrade]
279
+
280
+ /**
281
+ * The grade every row of THIS artifact carries. A government department republishing local authorities' adopted plans.
282
+ */
283
+ export const GZT_PROVENANCE_GRADE: ProvenanceGrade = ProvenanceGrade.Authoritative
284
+
285
+ /**
286
+ * What the product does NOT state, in the Department's own words.
287
+ *
288
+ * Carried onto every reading, because a caller holding a zone code cannot see from it that the answer is a generalised
289
+ * republication rather than the plan itself. The first of these is the sharpest constraint the Department states, and
290
+ * it is why this layer reports what a plan assigns at a location and never what may be built there.
291
+ */
292
+ export const GZT_PRODUCT_LIMITS: ReadonlyArray<string> = [
293
+ "Myplan.ie data are not published here as legal definitions of the current actuality with regard to Local Authority zoning or their geographic extents.",
294
+ "Myplan.ie uses a generalised, homogenised version of Local Authority data. Original data should be sourced directly from the relevant Local Authority.",
295
+ "This represents a consistent zoning scheme across all local authorities, and complements (rather than replaces) the existing statutory zoning used for each individual plan.",
296
+ "Awaiting data for some Local Authorities - please see map viewer for coverage details.",
297
+ "The Department does not guarantee that the digital data is free of minor errors not materially affecting performance.",
298
+ ]
299
+
300
+ /**
301
+ * Why this layer's coverage licenses no negative claim, in one sentence a receipt can carry.
302
+ *
303
+ * THE MEANING-OF-ZERO RULE UNDER ITS HARDEST CASE. For flood zones the Environment Agency states England-wide coverage
304
+ * and the Planning Practice Guidance defines Zone 1 as the absence, so a location with no polygon IS a designation. No
305
+ * such definition exists anywhere for zoning. A location with no zoning polygon is one of at least four different
306
+ * things: outside any adopted plan area, inside a plan area on land the plan does not zone, in a jurisdiction that has
307
+ * never adopted zoning, or in a jurisdiction whose records nobody has published. And the source can state one of them
308
+ * positively — `ZONE_ORIG = "UNZ - Unzoned"` appears on 4 of 85,330 rows — which is what proves the other absences are
309
+ * absences rather than designations.
310
+ */
311
+ export const GZT_COVERAGE_LIMIT =
312
+ "The Department publishes zoning polygons and states its coverage detail only inside a map viewer, so this layer " +
313
+ "records source presence only. A location with no zoning polygon may be outside any adopted plan area, inside one on " +
314
+ "land the plan does not zone, in a jurisdiction that has never adopted zoning, or in a jurisdiction whose records are " +
315
+ "not yet published — and the product cannot tell those apart, so nothing here supports a claim that no restriction applies."
316
+
317
+ /**
318
+ * The one local code that states unzoned land POSITIVELY, and the reason the coverage rule above is grounded rather
319
+ * than asserted: where the authority means "unzoned" it says so on a row, so every other absence is a row that is not
320
+ * there.
321
+ */
322
+ export const GZT_UNZONED_LOCAL_CODE = "UNZ - Unzoned"
323
+
324
+ /**
325
+ * Refuse a manifest that would ship this layer under a licence nobody resolved.
326
+ *
327
+ * A GUARD RATHER THAN A CONVENTION, for the same reason the coverage basis is one: the tier is a field, and a field can
328
+ * be edited without anyone reading the three statements that disagree. Moving this layer to `shipped` has to go through
329
+ * a line that names what is unresolved.
330
+ *
331
+ * @throws {Error} When a `shipped` tier is asked for while the licence is unresolved.
332
+ */
333
+ export function assertTierMatchesLicense(tier: string, license: string): void {
334
+ if (tier !== "shipped") return
335
+
336
+ if (license === GZT_LICENSE) {
337
+ throw new Error(
338
+ `zoning build: tier "shipped" was asked for while the licence reads ${JSON.stringify(GZT_LICENSE)}. ` +
339
+ `${GZT_LICENSE_CONTRADICTION} Resolve the grant in writing first, then change both this guard and the tier.`
340
+ )
341
+ }
342
+ }
package/out/index.d.ts ADDED
@@ -0,0 +1,257 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The `zoning-ireland.db` reader — what a local authority's adopted plan assigns at a coordinate, in that
7
+ * authority's own vocabulary, and on what basis.
8
+ *
9
+ * TWO READINGS, AND THE ONE THAT IS MISSING IS THE POINT.
10
+ *
11
+ * 1. `designated` — an adopted plan places the location inside a zoning polygon, and the polygon is the
12
+ * answer: the authority's own code, its own description, the plan it belongs to and that plan's stated
13
+ * window, with the Department's national generic type BESIDE the local code rather than instead of it.
14
+ * 2. `unknown` — no polygon contains the point. THAT IS NOT AN ABSENCE READING, and this layer has none.
15
+ *
16
+ * THERE IS NO `designated_absence` HERE, AND ZONING IS THE HARDEST CASE OF THE RULE. For flood zones the
17
+ * Environment Agency states England-wide coverage and the Planning Practice Guidance defines Zone 1 as the
18
+ * land outside Zones 2 and 3, so an empty answer inside England IS a designation. No such definition exists
19
+ * anywhere for zoning: a location with no zoning polygon is outside any adopted plan area, or inside one on
20
+ * land the plan does not zone, or in a jurisdiction that has never adopted zoning, or in a jurisdiction
21
+ * whose records nobody has published — and no product distinguishes them. The source itself proves the
22
+ * asymmetry: it states `UNZ - Unzoned` as a POSITIVE value on 4 of 85,330 rows, so where the authority
23
+ * means unzoned it says so, and every other absence is a row that is not there.
24
+ *
25
+ * SO THE CONSTRUCTOR REFUSES A COVERAGE ROW THAT WOULD SUPPORT AN EXCLUSION. Every row must read
26
+ * `source_present`; `supportsExclusion` must be false for all of them. That is not a convention this reader
27
+ * follows — it is a condition it checks at open time, so the day someone writes a stronger basis without
28
+ * settling the footprint question, the layer refuses to open rather than answering confidently.
29
+ *
30
+ * NEITHER READING IS A STATEMENT ABOUT WHAT MAY BE BUILT. The layer reports what a plan assigns at a
31
+ * location, which is a fact about the plan. The Department states that its data are "not published here as
32
+ * legal definitions of the current actuality with regard to Local Authority zoning or their geographic
33
+ * extents" and that "Original data should be sourced directly from the relevant Local Authority" — and
34
+ * `limits` carries the authority's own exclusions on every answer.
35
+ *
36
+ * THE PLAN IS PART OF THE CLAIM, NEVER A PARAMETER OF IT. A zone exists inside a named Development Plan or
37
+ * Local Area Plan with a stated validity window; a reading that dropped the plan would answer a question no
38
+ * authority asked. And `currentPlan = 1` means "not superseded", not "in force today": 2,363 of 85,330 rows
39
+ * carry a `validTo` already in the past, so the window travels on every reading and the comparison against a
40
+ * date is the caller's, made against a clock this reader does not own.
41
+ *
42
+ * THE PROBE IS STRUCTURE FIRST, GEOMETRY LAST. `cellToParent` up the compacted whole-cell chain answers an
43
+ * interior point with primary-key probes alone; only a cell a boundary crosses reaches the ray cast, and
44
+ * then only against the polygons `zoning_cell` already named for that cell.
45
+ *
46
+ * THE READER IS SYNCHRONOUS AND USES RAW PREPARED STATEMENTS, for the same reason the sibling layer readers
47
+ * are: it answers one point per geocode with a bounded number of primary-key probes plus a bounded geometry
48
+ * read, and the ray cast it wraps is synchronous anyway. The DDL that created these tables IS Kysely — see
49
+ * `schema.ts`.
50
+ */
51
+ import { CoverageBasis, type CoverageCell, type LayerManifest } from "@mailwoman/core/layers";
52
+ export { GZT_LAYER_NAME, ProvenanceGrade } from "#vocabulary";
53
+ /**
54
+ * What the layer can say about a coordinate.
55
+ */
56
+ export declare const ZoningReadingKind: {
57
+ /**
58
+ * An adopted plan places this location inside a zoning polygon.
59
+ */
60
+ readonly Designated: "designated";
61
+ /**
62
+ * No zoning polygon contains the point. NEVER an absence reading — see this file's header.
63
+ */
64
+ readonly Unknown: "unknown";
65
+ };
66
+ export type ZoningReadingKind = (typeof ZoningReadingKind)[keyof typeof ZoningReadingKind];
67
+ /**
68
+ * How containment was established.
69
+ */
70
+ export declare const ZoningContainmentPath: {
71
+ /**
72
+ * The cell lies wholly inside the zone; no geometry was read.
73
+ */
74
+ readonly WholeCell: "whole_cell";
75
+ /**
76
+ * The cell is crossed by a boundary; the point was ray-cast against the polygons named for that cell.
77
+ */
78
+ readonly RayCast: "ray_cast";
79
+ /**
80
+ * No zone reaches this cell at all.
81
+ */
82
+ readonly NoZoneCell: "no_zone_cell";
83
+ };
84
+ export type ZoningContainmentPath = (typeof ZoningContainmentPath)[keyof typeof ZoningContainmentPath];
85
+ /**
86
+ * The authority that adopted the plan.
87
+ */
88
+ export interface ZoningJurisdiction {
89
+ jurisdictionID: string;
90
+ name: string;
91
+ /**
92
+ * The publisher's own code, verbatim — `Fl` for Fingal, against `CL`, `CO`, `DU` for the rest.
93
+ */
94
+ sourceCode: string;
95
+ country: string;
96
+ }
97
+ /**
98
+ * The plan a zone belongs to, with its own stated window.
99
+ */
100
+ export interface ZoningPlan {
101
+ planID: string;
102
+ name: string;
103
+ /**
104
+ * `DP` Development Plan, `LAP` Local Area Plan, `SDZ` Strategic Development Zone.
105
+ */
106
+ level: string;
107
+ validFrom: string | null;
108
+ validTo: string | null;
109
+ /**
110
+ * The publisher's `CURRENT_PLAN` flag, carried as published. `1` means NOT SUPERSEDED — not "in force today".
111
+ */
112
+ currentPlan: number;
113
+ }
114
+ /**
115
+ * One zoning polygon the point falls inside, as the authority publishes it.
116
+ */
117
+ export interface ZoningDesignation {
118
+ areaID: string;
119
+ /**
120
+ * The authority's own zone code, verbatim.
121
+ */
122
+ localCode: string;
123
+ localDescription: string | null;
124
+ localCodeURL: string | null;
125
+ /**
126
+ * The publishing authority's OWN crosswalk into a shared scheme, where it publishes one. Beside the local code, never
127
+ * instead of it: 52 of 795 (authority, local code) pairs take more than one generic type, so this cannot be
128
+ * reconstructed from `localCode` and is a per-polygon fact the Department authored.
129
+ */
130
+ crosswalk?: {
131
+ scheme: string;
132
+ code: string;
133
+ description: string | null;
134
+ /**
135
+ * A coarser code from the same authority, carried as published.
136
+ */
137
+ rollup: string | null;
138
+ /**
139
+ * The publisher's own label for `code`, from its declared domain — absent for a code the publisher uses and never
140
+ * declared.
141
+ */
142
+ label?: string;
143
+ /**
144
+ * `false` where the publisher uses this code without declaring it in its own domain.
145
+ */
146
+ declared: boolean;
147
+ };
148
+ /**
149
+ * One of {@link ProvenanceGrade}. Every row of THIS artifact is `authoritative`; the column exists because a query
150
+ * answered from an `inferred` row may never be presented as the authority's designation.
151
+ */
152
+ provenanceGrade: string;
153
+ jurisdiction: ZoningJurisdiction;
154
+ plan: ZoningPlan;
155
+ /**
156
+ * The authority states unzoned land POSITIVELY on a handful of rows. `true` here is the authority saying so; an
157
+ * ABSENT designation says nothing at all, which is the distinction this layer exists to keep.
158
+ */
159
+ unzoned: boolean;
160
+ containment: ZoningContainmentPath;
161
+ }
162
+ /**
163
+ * One reading, carrying everything a caller needs to re-derive it rather than take it.
164
+ */
165
+ export interface ZoningReading {
166
+ kind: ZoningReadingKind;
167
+ /**
168
+ * Every polygon containing the point, ordered by `area_id`. Usually one; several where a Local Area Plan overlays a
169
+ * Development Plan over the same ground, which the source publishes as two rows.
170
+ */
171
+ designations: ZoningDesignation[];
172
+ containment: ZoningContainmentPath;
173
+ /**
174
+ * The coverage row for the location, when the product has data in that cell. Its basis is always `source_present`, so
175
+ * it licenses PRESENCE and nothing else — an absent coverage row and a present one are both compatible with "no
176
+ * zoning polygon here", and neither says the location is unrestricted.
177
+ */
178
+ coverage?: CoverageCell & {
179
+ h3CellIndex: string;
180
+ resolution: number;
181
+ };
182
+ /**
183
+ * The index cell probed, for a receipt.
184
+ */
185
+ indexCellIndex: string;
186
+ /**
187
+ * What the product does not state, in the authority's own words.
188
+ */
189
+ limits: ReadonlyArray<string>;
190
+ /**
191
+ * Why this layer's coverage licenses no negative claim, in one sentence.
192
+ */
193
+ coverageLimit: string;
194
+ }
195
+ /**
196
+ * The layer's identity, read once at open time.
197
+ */
198
+ export interface ZoningLayerIdentity {
199
+ manifest: LayerManifest;
200
+ indexResolution: number;
201
+ coverageResolution: number;
202
+ /**
203
+ * Every resolution `zoning_cell` stores a row at, coarsest first — the ancestor chain a probe walks.
204
+ *
205
+ * Several, and necessarily so: each feature's whole tier is compacted parent-ward, and a polygon too large for h3's
206
+ * allocator at the index resolution was indexed coarser. A reader that probed one resolution would read every row at
207
+ * the others as an absence.
208
+ */
209
+ cellResolutions: number[];
210
+ /**
211
+ * The jurisdictions the layer holds, by id.
212
+ */
213
+ jurisdictions: ReadonlyMap<string, ZoningJurisdiction>;
214
+ /**
215
+ * The crosswalk scheme this layer's rows carry, or `undefined` where the publisher ships none.
216
+ */
217
+ crosswalkScheme?: string;
218
+ /**
219
+ * The authority's footprint statements. EMPTY in this edition, which is what makes `source_present` the only basis
220
+ * the coverage may carry — see `schema.ts`.
221
+ */
222
+ mappedExtents: Array<{
223
+ extentID: string;
224
+ source: string;
225
+ statement: string;
226
+ statementURL: string;
227
+ }>;
228
+ /**
229
+ * The coverage basis every row carries. Always `source_present` while `mappedExtents` is empty; checked at open time
230
+ * rather than assumed.
231
+ */
232
+ coverageBasis: CoverageBasis;
233
+ databasePath: string;
234
+ }
235
+ export interface ZoningLookupOptions {
236
+ databasePath: string;
237
+ }
238
+ /**
239
+ * Read a sealed `zoning-ireland.db`.
240
+ *
241
+ * Everything that would make the reader answer a well-formed wrong thing is refused at CONSTRUCTION rather than at
242
+ * query time: a manifest naming a different layer, a coverage table with no rows, a coverage row whose basis would
243
+ * support an exclusion, an empty jurisdiction table. Each of those would otherwise present as a reader that quietly
244
+ * always answers `unknown` — or, in the exclusion case, as a reader that confidently reports unzoned-and-unmapped land
245
+ * as free of restriction.
246
+ */
247
+ export declare class ZoningLookup implements Disposable {
248
+ #private;
249
+ readonly identity: ZoningLayerIdentity;
250
+ constructor(options: ZoningLookupOptions);
251
+ /**
252
+ * What an adopted plan assigns at this coordinate.
253
+ */
254
+ lookup(latitude: number, longitude: number): ZoningReading;
255
+ [Symbol.dispose](): void;
256
+ }
257
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,EAGN,aAAa,EAEb,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,MAAM,wBAAwB,CAAA;AAuB/B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7D;;GAEG;AACH,eAAO,MAAM,iBAAiB;IAC7B;;OAEG;;IAEH;;OAEG;;CAEM,CAAA;AAEV,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAA;AAE1F;;GAEG;AACH,eAAO,MAAM,qBAAqB;IACjC;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;CAEM,CAAA;AAEV,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAA;AAEtG;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,cAAc,EAAE,MAAM,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B;;;;OAIG;IACH,SAAS,CAAC,EAAE;QACX,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;QAC1B;;WAEG;QACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;QACrB;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAA;QACd;;WAEG;QACH,QAAQ,EAAE,OAAO,CAAA;KACjB,CAAA;IACD;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,kBAAkB,CAAA;IAChC,IAAI,EAAE,UAAU,CAAA;IAChB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,qBAAqB,CAAA;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,iBAAiB,CAAA;IACvB;;;OAGG;IACH,YAAY,EAAE,iBAAiB,EAAE,CAAA;IACjC,WAAW,EAAE,qBAAqB,CAAA;IAClC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,YAAY,GAAG;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;IACrE;;OAEG;IACH,cAAc,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC7B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE,aAAa,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,kBAAkB,EAAE,MAAM,CAAA;IAC1B;;;;;;OAMG;IACH,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB;;OAEG;IACH,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IACtD;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;OAGG;IACH,aAAa,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACnG;;;OAGG;IACH,aAAa,EAAE,aAAa,CAAA;IAC5B,YAAY,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,mBAAmB;IACnC,YAAY,EAAE,MAAM,CAAA;CACpB;AA6BD;;;;;;;;GAQG;AACH,qBAAa,YAAa,YAAW,UAAU;;IAC9C,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAA;gBAU1B,OAAO,EAAE,mBAAmB;IAmCxC;;OAEG;IACI,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa;IAgB1D,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;CAsI/B"}