@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.
Files changed (98) hide show
  1. package/README.md +169 -163
  2. package/lib/index.ts +89 -120
  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 +96 -114
  7. package/lib/vocabulary.ts +52 -130
  8. package/out/index.d.ts +75 -95
  9. package/out/index.d.ts.map +1 -1
  10. package/out/index.js +25 -82
  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 +93 -108
  25. package/out/schema.d.ts.map +1 -1
  26. package/out/schema.js +16 -44
  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 +48 -137
  31. package/out/sdk/build-zoning.js.map +1 -1
  32. package/out/sdk/cells.d.ts +20 -61
  33. package/out/sdk/cells.d.ts.map +1 -1
  34. package/out/sdk/cells.js +13 -50
  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 +7 -27
  43. package/out/sdk/download.js.map +1 -1
  44. package/out/sdk/ingest/chunk.d.ts +106 -0
  45. package/out/sdk/ingest/chunk.d.ts.map +1 -0
  46. package/out/sdk/{ingest-chunk.js → ingest/chunk.js} +17 -50
  47. package/out/sdk/ingest/chunk.js.map +1 -0
  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} +5 -7
  51. package/out/sdk/ingest/worker.js.map +1 -0
  52. package/out/sdk/ingest.d.ts +54 -77
  53. package/out/sdk/ingest.d.ts.map +1 -1
  54. package/out/sdk/ingest.js +50 -87
  55. package/out/sdk/ingest.js.map +1 -1
  56. package/out/sdk/measure-resolutions.d.ts +6 -23
  57. package/out/sdk/measure-resolutions.d.ts.map +1 -1
  58. package/out/sdk/measure-resolutions.js +4 -21
  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 +74 -56
  65. package/out/sdk/verify.d.ts.map +1 -1
  66. package/out/sdk/verify.js +70 -57
  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 +37 -161
  73. package/{lib/sdk → sdk}/build-zoning.ts +100 -186
  74. package/{lib/sdk → sdk}/cells.ts +24 -63
  75. package/{lib/sdk → sdk}/client.ts +34 -82
  76. package/sdk/download.ts +58 -0
  77. package/{lib/sdk/ingest-chunk.ts → sdk/ingest/chunk.ts} +32 -61
  78. package/{lib/scripts/ingest-chunk.ts → sdk/ingest/worker.ts} +4 -6
  79. package/sdk/ingest.ts +366 -0
  80. package/{lib/sdk → sdk}/measure-resolutions.ts +8 -25
  81. package/{lib → sdk}/test-kit.ts +20 -43
  82. package/{lib/sdk → sdk}/verify.ts +102 -75
  83. package/lib/sdk/download.ts +0 -78
  84. package/lib/sdk/index.ts +0 -15
  85. package/lib/sdk/ingest.ts +0 -398
  86. package/out/scripts/ingest-chunk.d.ts +0 -11
  87. package/out/scripts/ingest-chunk.d.ts.map +0 -1
  88. package/out/scripts/ingest-chunk.js.map +0 -1
  89. package/out/sdk/index.d.ts +0 -15
  90. package/out/sdk/index.d.ts.map +0 -1
  91. package/out/sdk/index.js +0 -15
  92. package/out/sdk/index.js.map +0 -1
  93. package/out/sdk/ingest-chunk.d.ts +0 -130
  94. package/out/sdk/ingest-chunk.d.ts.map +0 -1
  95. package/out/sdk/ingest-chunk.js.map +0 -1
  96. package/out/test-kit.d.ts +0 -96
  97. package/out/test-kit.d.ts.map +0 -1
  98. package/out/test-kit.js.map +0 -1
package/README.md CHANGED
@@ -1,173 +1,176 @@
1
1
  # `@mailwoman/zoning`
2
2
 
3
- Ireland's **Generalised Zoning Types** as a sealed spatial layer: what a local authority's adopted plan
4
- assigns at a coordinate, in that authority's own vocabulary, with the plan it belongs to and that plan's
5
- stated window.
3
+ This package provides Ireland's **Generalised Zoning Types** as a sealed spatial layer. The layer reports
4
+ what a local authority's adopted plan assigns at a coordinate, in that authority's own vocabulary, together
5
+ with the plan and that plan's stated window.
6
6
 
7
- Published by the Department of Housing, Local Government and Heritage for the MyPlan.ie project, covering
8
- **30 of the Republic's 31 local authorities**. The one absent is Donegal County Council. Against Census 2022
9
- (CSO table `FY003A`), **4,982,055 of 5,149,139 residents — 96.76% — live in a local authority whose zoning is
10
- represented in the layer.** That is a jurisdiction statement and nothing more: living in a covered authority
11
- is not the same as having a zoning polygon at your address.
7
+ The Department of Housing, Local Government and Heritage publishes the data for the MyPlan.ie project. It
8
+ covers **30 of the Republic's 31 local authorities**, and Donegal County Council is the one missing. Against
9
+ Census 2022 (CSO table `FY003A`), **4,982,055 of 5,149,139 residents (96.76%) live in a local authority whose
10
+ zoning is represented in the layer.** That figure describes jurisdictions only. An address in a covered authority
11
+ does not mean that a zoning polygon covers your address.
12
12
 
13
13
  **The artifact is built locally and never redistributed.** Three published statements disagree about the
14
- source's license, so the manifest carries `tier: build-local` and `license: NOASSERTION`, and the builder
15
- refuses a `shipped` tier until that is resolved in writing. See _Licence and posture_ below.
14
+ source's license, so the manifest carries `tier: build-local` and `license: NOASSERTION`. The builder refuses
15
+ a `shipped` tier until the license question is resolved in writing. See _Licence and posture_ below.
16
16
 
17
17
  ## What it reports, and what it refuses to
18
18
 
19
- Two readings, and the one that is missing is the point.
19
+ The layer has two readings. The reading it lacks matters most.
20
20
 
21
- | reading | what it means |
22
- | ------------ | ------------------------------------------------------------------------------------------ |
23
- | `designated` | An adopted plan places the location inside a zoning polygon, and the polygon is the answer |
24
- | `unknown` | No zoning polygon contains the point. **Not an absence reading, and this layer has none** |
21
+ | reading | what it means |
22
+ | ------------ | ---------------------------------------------------------------------------------------------------------------- |
23
+ | `designated` | An adopted plan places the location inside a zoning polygon, and the polygon is the answer |
24
+ | `unknown` | No zoning polygon contains the point. This reading does not claim absence, and this layer has no absence reading |
25
25
 
26
- **There is no `designated_absence` here, and zoning is the hardest case of the rule.** For flood zones the
27
- Environment Agency states England-wide coverage and the Planning Practice Guidance defines Zone 1 as the land
28
- outside Zones 2 and 3, so an empty answer inside England IS a designation. No such definition exists anywhere
29
- for zoning. A location with no zoning polygon is one of at least four different things:
26
+ **This layer has no `designated_absence` reading, and zoning is the hardest case of this rule.** For flood
27
+ zones the Environment Agency states England-wide coverage, and the Planning Practice Guidance defines Zone 1
28
+ as the land outside Zones 2 and 3, so an empty flood answer inside England is a designation. The zoning layer has no
29
+ such definition anywhere. A location with no zoning polygon can be in at least four different situations:
30
30
 
31
- 1. Outside any adopted plan area — most land in most countries. The authority has said nothing.
31
+ 1. Outside any adopted plan area, which covers most land in most countries. The authority has made no statement.
32
32
  2. Inside a plan area, on land the plan does not zone.
33
33
  3. In a jurisdiction that has never adopted zoning at all.
34
34
  4. In a jurisdiction whose records nobody has read or published yet.
35
35
 
36
- **And the source can state one of them positively, which is what proves the rest are absences.** It carries
37
- `ZONE_ORIG = "UNZ - Unzoned"` with `ZONE_GZT = "N/A"` on 4 of its 85,330 rows. Where the authority means
38
- unzoned it says so on a row; every other absence is a row that is not there.
36
+ **The source states one of these cases explicitly, which shows that the other cases are absences.** It
37
+ carries `ZONE_ORIG = "UNZ - Unzoned"` with `ZONE_GZT = "N/A"` on 4 of its 85,330 rows. When the authority
38
+ means unzoned, it writes that on a row. Every other absence is a missing row.
39
39
 
40
- So every `layer_coverage` row carries `basis = source_present`, the reader refuses to OPEN an artifact
41
- carrying anything stronger, and the observation stays silent where no polygon contains the point.
40
+ Every `layer_coverage` row therefore carries `basis = source_present`. The reader refuses to open an artifact
41
+ that carries anything stronger, and the observation stays silent where no polygon contains the point.
42
42
 
43
- **Neither reading is a statement about what may be built.** The Department states that its data are "not
44
- published here as legal definitions of the current actuality with regard to Local Authority zoning or their
45
- geographic extents" and that "Original data should be sourced directly from the relevant Local Authority".
46
- Those exclusions ride on every reading.
43
+ **Neither reading states what may be built.** The Department states that its data are "not published here as
44
+ legal definitions of the current actuality with regard to Local Authority zoning or their geographic extents"
45
+ and that "Original data should be sourced directly from the relevant Local Authority". Every reading carries
46
+ those exclusions.
47
47
 
48
48
  ## The vocabulary decision — the verbatim code, and the crosswalk beside it
49
49
 
50
- This is the layer's distinctive contract, and Ireland is a natural experiment on it: a national authority
51
- already built the crosswalk, over one small country, with statutory access to the plans.
50
+ The crosswalk design is what distinguishes this layer. Ireland provides a natural test of it, because a
51
+ national authority has already built a crosswalk for one small country with statutory access to the plans.
52
52
 
53
- Measured over the whole national export:
53
+ These figures cover the whole national export:
54
54
 
55
55
  | measurement | value |
56
56
  | --------------------------------------------------------------- | ------: |
57
57
  | distinct local zone strings (`ZONE_ORIG`) across 30 authorities | **581** |
58
58
  | the same, trimmed and case-folded | **555** |
59
59
  | distinct national generic types (`ZONE_GZT`) observed | **55** |
60
- | generic types the service's own coded-value domain DECLARES | **54** |
60
+ | generic types the service's own coded-value domain declares | **54** |
61
61
  | distinct `(authority, local code)` pairs | **795** |
62
- | **pairs taking MORE THAN ONE generic type** | **52** |
62
+ | **pairs taking more than one generic type** | **52** |
63
63
 
64
- **The decisive one is the last.** If a local code determined a generic type, the mapping could ship as a
65
- lookup and the local column would be redundant. It does not: Cork County Council's `Special Policy Area` takes
66
- **14** different generic types, its `Green Infrastructure` **12**, and Clare's `Utilities` **11**. The mapping
67
- is per polygon, authored by a person reading a plan, and it cannot be reconstructed from the pair of columns.
64
+ **The last figure decides the design.** If a local code determined a generic type, the mapping could ship as
65
+ a lookup and the local column would be redundant. A local code does not determine the type. Cork County
66
+ Council's `Special Policy Area` takes **14** different generic types, its `Green Infrastructure` takes **12**,
67
+ and Clare's `Utilities` takes **11**. A person assigned the mapping per polygon while reading a plan, and it
68
+ cannot be reconstructed from the pair of columns.
68
69
 
69
- So `zoning_area` carries **both**, and `zoning_crosswalk_edge` ships **empty** — checked rather than assumed:
70
- `assertCrosswalkIsNotATable` refuses a build that would write an edge while any pair is non-functional.
70
+ `zoning_area` therefore carries **both** columns, and `zoning_crosswalk_edge` ships **empty**. Code checks
71
+ this: `assertCrosswalkIsNotATable` refuses a build that would write an edge while any pair maps to more than
72
+ one type.
71
73
 
72
- The Department says the same thing in its own words, in the item description:
74
+ The Department says the same thing in the item description:
73
75
 
74
76
  > This represents a consistent zoning scheme across all local authorities, and **complements (rather than
75
77
  > replaces) the existing statutory zoning used for each individual plan**.
76
78
 
77
- **The declared domain is closed and the source already breaks it.** 54 declared against 55 used: `N/A` appears
78
- on 4 rows and in no domain. So `zoning_vocabulary` carries the declared domain **plus** the values observed in
79
- the data, with `declared` separating them — folding the two would either hide a source-schema change or invent
80
- a declaration the Department never made. A declared code the data never uses is kept at `observed_rows = 0`
81
- for the same reason: `SDZ` is a real plan level nobody has used yet.
79
+ **The declared domain is closed, and the source already violates it.** The domain declares 54 codes and the
80
+ data uses 55, because `N/A` appears on 4 rows and in no domain. `zoning_vocabulary` therefore carries the
81
+ declared domain **plus** the values observed in the data, and the `declared` column separates them. A merge of the
82
+ two would either hide a source-schema change or invent a declaration that the Department never made. For the
83
+ same reason, a declared code that the data never uses is kept with `observed_rows = 0`. `SDZ` is a real plan
84
+ level that nobody has used yet.
82
85
 
83
86
  ## Three measured source behaviors a builder has to know
84
87
 
85
88
  ### Hole roles come from ring ORIENTATION, and clockwise is the exterior
86
89
 
87
- The inverse of RFC 7946's convention, and the one thing about this source that produces a well-formed wrong
88
- answer in silence. Measured over the whole national export (85,330 features, 93,483 rings):
90
+ This is the inverse of RFC 7946's convention, and it is the one property of this source that silently produces
91
+ a well-formed wrong answer. These figures cover the whole national export (85,330 features, 93,483 rings):
89
92
 
90
93
  | reading | km² |
91
94
  | ---------------------------------------------------------- | ----------: |
92
95
  | sum of signed ring areas, in the source's own ITM meters | **5,444.5** |
93
96
  | the Department's own `Shape__Area` sum | **5,444.5** |
94
- | sum of ABSOLUTE ring areas, in the source's own ITM meters | **5,666.6** |
95
-
96
- **Read in the source's own projection the signed sum matches the publisher to eight decimal places**
97
- (5,444,492,956.43 m² against 5,444,492,956.40) — which is what settles the convention. The BUILD compares a
98
- spherical reading of the reprojected rings, so its own numbers sit a few tenths of a percent away from both:
99
- 5,423.2 km² with holes against the publisher's 5,444.5 (**0.392% apart**), and 5,644.4 km² without them
100
- (**3.7% away**). That gap between the two readings is the signal, and the 1% build tolerance sits between them
101
- with room on each side — Irish Transverse Mercator's scale factor and a spherical approximation together
102
- contribute a few tenths of a percent, and hole-blindness contributes ten times that.
103
-
104
- 89,967 rings are clockwise and 3,516 counter-clockwise; 1,309 features carry both windings. Of those, 1,210
105
- nest their holes inside one polygon part the way RFC 7946 expects and the rest put every ring in its own
106
- `MultiPolygon` part — the largest feature in the country, Meath's `RA - Rural Area`, arrives as 107 single-ring
107
- parts of which 5 are clockwise and 102 counter-clockwise. **Both encodings reach the ingest, and the
108
- orientation is the only signal that means the same thing in both.**
109
-
110
- **Two residuals, both measured and both carried rather than refused.** Nine of the 3,516 holes share their
111
- parent's boundary rather than sitting inside it — every one a sliver under 1.7 m² — and go to the smallest
112
- exterior of their own feature, which on eight of the nine is the only exterior there is. And **exactly one
113
- feature of 85,330** has no ring the rule can read as an exterior at all: `OBJECTID` 74040, Galway County
97
+ | sum of absolute ring areas, in the source's own ITM meters | **5,666.6** |
98
+
99
+ **In the source's own projection, the signed sum matches the publisher to eight decimal places**
100
+ (5,444,492,956.43 m² against 5,444,492,956.40), which settles the convention. The build compares a spherical
101
+ reading of the reprojected rings, so its own numbers sit a few tenths of a percent away from both: 5,423.2 km²
102
+ with holes against the publisher's 5,444.5 (**0.392% apart**), and 5,644.4 km² without them (**3.7% away**).
103
+ The gap between those two readings is the signal, and the 1% build tolerance sits between them with room on
104
+ each side. Irish Transverse Mercator's scale factor and the spherical approximation together contribute a few
105
+ tenths of a percent, and ignoring holes contributes ten times that.
106
+
107
+ 89,967 rings are clockwise and 3,516 are counter-clockwise, and 1,309 features carry both windings. Of those,
108
+ 1,210 nest their holes inside one polygon part as RFC 7946 expects. The rest put every ring in its own
109
+ `MultiPolygon` part. The largest feature in the country, Meath's `RA - Rural Area`, arrives as 107 single-ring
110
+ parts, of which 5 are clockwise and 102 counter-clockwise. **Both encodings reach the ingest, and orientation is
111
+ the only signal that means the same thing in both.**
112
+
113
+ **Two residual cases are measured and handled instead of rejected.** Nine of the 3,516 holes share their
114
+ parent's boundary instead of sitting inside it. Each is a sliver under 1.7 m², and each is assigned to the
115
+ smallest exterior of its own feature, which on eight of the nine is the feature's only exterior. **Exactly one
116
+ feature of 85,330** has no ring that the rule can read as an exterior: `OBJECTID` 74040, Galway County
114
117
  Council's `Agriculture`, a three-vertex ring enclosing 3.0 × 10⁻⁷ m². At that magnitude a ring's winding is
115
- floating-point noise rather than something the publisher stated — it reads clockwise in the source's own Irish
116
- Transverse Mercator meters and counter-clockwise after reprojection — so the largest ring by magnitude becomes
117
- the exterior, which is also the correct reading for a feature published wholly inverted. Both counts ride on
118
- the build receipt rather than being implied to be zero.
118
+ floating-point noise and not something the publisher stated. It reads clockwise in the source's own Irish
119
+ Transverse Mercator meters and counter-clockwise after reprojection. The largest ring by magnitude therefore
120
+ becomes the exterior, which is also the correct reading for a feature published wholly inverted. The build
121
+ receipt reports both counts explicitly.
119
122
 
120
- The area error is 4.1% and is the harmless half. The harmful half is that a ray cast treating all 107 rings as
121
- exteriors answers "inside `P5` rural zoning" for every location the plan carved out.
123
+ The area error is 4.1%, and it is the harmless consequence. The harmful consequence is that a ray cast
124
+ treating all 107 rings as exteriors answers "inside `P5` rural zoning" for every location the plan carved out.
122
125
 
123
- **GDAL cannot be asked to preserve this**, which is why the ingest streams WKT rather than GeoJSON. Its GeoJSON
124
- writer enforces the RFC 7946 winding unconditionally — `-lco RFC7946=NO` is not a GeoJSONSeq option and
125
- `--config OGR_ORGANIZE_POLYGONS SKIP` changes nothing — so through GeoJSONSeq the Meath feature arrives as 107
126
- counter-clockwise exteriors totalling 2,371.9 km² against the Department's 2,232.1 km². The same conversion
127
- written as CSV/WKT keeps the source's 5/102 split intact.
126
+ **GDAL has no option that preserves this orientation**, so the ingest streams WKT instead of GeoJSON. GDAL's
127
+ GeoJSON writer always enforces the RFC 7946 winding. `-lco RFC7946=NO` is not a GeoJSONSeq option, and
128
+ `--config OGR_ORGANIZE_POLYGONS SKIP` has no effect. Through GeoJSONSeq the Meath feature therefore arrives as
129
+ 107 counter-clockwise exteriors totaling 2,371.9 km² against the Department's 2,232.1 km². The same
130
+ conversion written as CSV/WKT keeps the source's 5/102 split intact.
128
131
 
129
132
  ### The publisher's own area column is not in the archive
130
133
 
131
- `Shape__Area` is a service field and the bulk GeoJSON export drops it, so the area cross-check reads it from the
132
- live service instead — which is what makes it a two-path check rather than the archive agreeing with
133
- itself. Measured: 5,444,492,956.40 m² over 85,330 features.
134
+ `Shape__Area` is a service field, and the bulk GeoJSON export drops it. The area cross-check therefore reads
135
+ it from the live service, which makes the check compare two independent paths instead of comparing the
136
+ archive with itself. The measured value is 5,444,492,956.40 m² over 85,330 features.
134
137
 
135
138
  ### The definition host has no DNS record
136
139
 
137
- All 85,330 rows link their generic type's definition to `viewer.myplan.ie`, which has no A or AAAA record, and
138
- three candidate replacements on the live host answer HTTP 404. The 54 code-to-label pairs survive in the
139
- service's own coded-value domain; the **definitions** behind them do not. So `zoning_vocabulary.definition_url`
140
- is NULL on every row rather than filled with a plausible one.
140
+ All 85,330 rows link their generic type's definition to `viewer.myplan.ie`, which has no A or AAAA record,
141
+ and three candidate replacements on the live host answer HTTP 404. The 54 code-to-label pairs survive in the
142
+ service's own coded-value domain, but the **definitions** behind them are lost. `zoning_vocabulary.definition_url`
143
+ is therefore NULL on every row instead of holding a plausible guess.
141
144
 
142
145
  ### And two acquisition behaviors
143
146
 
144
- - The Hub download job answers `{"status":"Completed","resultUrl":…}` in 249 bytes, and the result URL **302s**
145
- — the transfer follows redirects, and a client that took the first response as the file would write a
147
+ - The Hub download job answers `{"status":"Completed","resultUrl":…}` in 249 bytes, and the result URL returns
148
+ **302**. The transfer follows redirects. A client that took the first response as the file would write a
146
149
  redirect page to disk and report a successful download.
147
- - The bulk export is **EPSG:2157** (IRENET95 / Irish Transverse Mercator) declared in a top-level `crs` member
148
- RFC 7946 removed from the format. GDAL honours the legacy member; a strict reader ignores it and places
150
+ - The bulk export is **EPSG:2157** (IRENET95 / Irish Transverse Mercator), declared in a top-level `crs` member
151
+ that RFC 7946 removed from the format. GDAL honors the legacy member. A strict reader ignores it and places
149
152
  Ireland's zoning at latitude 735,435. The ingest asserts the source's declared authority code before reading
150
- a feature, and asserts every reprojected vertex inside the Department's own declared extent.
153
+ a feature, and asserts that every reprojected vertex lies inside the Department's own declared extent.
151
154
 
152
155
  ## The two tiers
153
156
 
154
157
  `zoning_area` holds the authority's **unsimplified** rings with their hole roles resolved, plus a precomputed
155
- bounding box; `zoning_cell` is an H3 containment index above it, `WITHOUT ROWID`, keyed `(h3_cell, area_id)`.
156
- A probe walks the index first and reaches the geometry only for a cell a boundary crosses.
158
+ bounding box. `zoning_cell` is an H3 containment index above it, `WITHOUT ROWID`, keyed `(h3_cell, area_id)`.
159
+ A probe walks the index first and reads the geometry only for a cell that a boundary crosses.
157
160
 
158
- **The index is cell-touches-polygon, never cell-center-in-polygon**, and a feature that reaches no cell fails
159
- the build. That is not a preference: `polygonToCells` — the polyfill a builder reaches for first — returns
160
- nothing at all for most of these polygons, and every dropped polygon would read downstream as an absence of
161
- zoning at exactly the question this layer exists to answer.
161
+ **The index records every cell that touches a polygon, never only cells whose center lies in it**, and a
162
+ feature that reaches no cell fails the build. The measurements require this. `polygonToCells`, the usual
163
+ first choice of polyfill, returns no cells for most of these polygons. Every dropped polygon would appear
164
+ downstream as an absence of zoning, which is exactly the question this layer exists to answer.
162
165
 
163
- `zoning_cell` rows are **mixed-resolution**: each feature's whole tier is compacted parent-ward, so a row
164
- carries its own `resolution` and a probe walks its own `cellToParent` chain over every resolution the table
165
- holds. `layer_coverage` stays single-resolution.
166
+ `zoning_cell` rows are **mixed-resolution**. Each feature's whole tier is compacted toward parent cells, so a
167
+ row carries its own `resolution`, and a probe walks its own `cellToParent` chain over every resolution the
168
+ table holds. `layer_coverage` stays single-resolution.
166
169
 
167
- ## The resolution is a measurement, and NOT the one the size contract names
170
+ ## The resolution is a measurement, and not the one the size interface names
168
171
 
169
- The inherited size contract picks a resolution from the measured `partial` share. **For this subject that
170
- statistic carries no signal**, and the reason was measured. Zoning polygons are mostly smaller than a cell:
172
+ The inherited size interface picks a resolution from the measured `partial` share. **For this subject that
173
+ statistic carries no signal**, and measurement shows why. Most zoning polygons are smaller than a cell:
171
174
 
172
175
  | percentile | p1 | p5 | p10 | p25 | **p50** | p75 | p90 | p95 | p99 |
173
176
  | ---------- | --: | --: | --: | ----: | --------: | -----: | -----: | -----: | ------: |
@@ -175,11 +178,11 @@ statistic carries no signal**, and the reason was measured. Zoning polygons are
175
178
 
176
179
  Against H3 average cell areas (h3-js 4.5.0): res 9 = 105,333 m², res 10 = 15,048 m², res 11 = 2,150 m².
177
180
  **95.7% of zoning polygons are smaller than an average res-9 cell**, 75.1% smaller than a res-10 cell and
178
- 34.5% smaller than a res-11 cell — so the `partial` share sits near 100% at every candidate and cannot choose
179
- between them.
181
+ 34.5% are smaller than a res-11 cell. The `partial` share therefore sits near 100% at every candidate and
182
+ cannot choose between them.
180
183
 
181
- Two numbers can, and both are measured over the FULL national set by
182
- `mailwoman gazetteer build zoning --measure-resolutions 9,10,11`:
184
+ Two other numbers can choose. `mailwoman gazetteer build zoning --measure-resolutions 9,10,11` measures both
185
+ over the full national set:
183
186
 
184
187
  | res | features | polyfill-only zero-cell | stored cell rows | touched cells | candidates/cell mean | p90 | max | cells >1 candidate | partial share | coarsened |
185
188
  | ------ | -------: | ----------------------: | ---------------: | ------------: | -------------------: | ----: | --: | -----------------: | ------------: | --------: |
@@ -187,29 +190,29 @@ Two numbers can, and both are measured over the FULL national set by
187
190
  | **10** | 85,330 | 48,412 (56.7%) | 237,411 | 426,993 | **1.69** | **3** | 55 | 121,884 (28.5%) | 40.6% | 0 |
188
191
  | 11 | 85,330 | 19,224 (22.5%) | 1,121,461 | 1,897,777 | 1.32 | 2 | 23 | 432,969 (22.8%) | 37.0% | 1 |
189
192
 
190
- **Resolution 10, chosen from those numbers.** Going from 9 to 10 takes the p90 candidate count from 9 to 3 — a
191
- threefold reduction in the geometry a fringe probe reads — for 4.9× the stored rows. Going on from 10 to 11 buys
192
- p90 3 → 2 for another 4.7× the rows. The knee is at 10, and the `partial` share (58.0 / 40.6 / 37.0%) has no
193
- knee at all, which is the measurement that says it is the wrong column to choose on.
193
+ **Resolution 10 was chosen from those numbers.** A move from 9 to 10 reduces the p90 candidate count from 9 to
194
+ 3, a threefold reduction in the geometry a fringe probe reads, for 4.9× the stored rows. A move from 10 to 11
195
+ reduces p90 from 3 to 2 for another 4.7× the rows. The curve bends at 10. The `partial` share (58.0 / 40.6 /
196
+ 37.0%) shows no bend at all, which confirms that it is the wrong column to choose on.
194
197
 
195
- **The left-hand column is the finding, and it is a defect waiting to happen.** At resolution 9, `polygonToCells`
196
- returns nothing at all for **73,068 of 85,330 polygons — 85.6%** — because no cell center falls inside them. A
197
- builder that indexed only the polyfill output would silently drop six of every seven zoning polygons, and every
198
- dropped polygon would read downstream as "no zoning here". Even at resolution 11 it drops 22.5%. The survey
199
- measured 86.8% on one urban authority; the national figure is 85.6%, measured rather than extrapolated.
198
+ **The polyfill column shows the most dangerous failure.** At resolution 9, `polygonToCells` returns no cells
199
+ for **73,068 of 85,330 polygons (85.6%)**, because no cell center falls inside them. A builder that indexed
200
+ only the polyfill output would silently drop six of every seven zoning polygons, and every dropped polygon
201
+ would appear downstream as "no zoning here". Even at resolution 11 it drops 22.5%. The survey measured 86.8% on
202
+ one urban authority, and the national figure, measured directly, is 85.6%.
200
203
 
201
- This index's own zero-cell count is **0 at every resolution**, by construction: `classifyFeatureCells` takes
202
- overlapping containment and throws on a feature that reaches no cell. One feature (Meath's 2,232 km² rural zone)
203
- is indexed coarser than 11 by the allocator budget, which is why the `coarsened` column reads 1 there.
204
+ This index's own zero-cell count is **0 at every resolution** by construction. `classifyFeatureCells` uses
205
+ overlapping containment and throws on a feature that reaches no cell. The allocator budget forces one feature
206
+ (Meath's 2,232 km² rural zone) to be indexed coarser than 11, so the `coarsened` column reads 1 there.
204
207
 
205
208
  ## The build, as it ran
206
209
 
207
- The full national build on this lab, at the chosen resolution 10 with coverage at res 6:
210
+ The full national build ran on this lab at the chosen resolution 10, with coverage at res 6:
208
211
 
209
212
  | what | measured |
210
213
  | ------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
211
214
  | acquisition | 247,452,342 bytes in 42.0 s, one anonymous request following the Hub job's redirect |
212
- | features | **85,330** — the archive, the service's `returnCountOnly` and the build all agree |
215
+ | features | **85,330**; the archive, the service's `returnCountOnly` and the build all agree |
213
216
  | authorities / plans | **30** local authorities, **63** plans |
214
217
  | rings | 93,483 total · 89,967 exterior · 3,516 hole · 3,507 holes nested · **9** on a parent's boundary · **1** exterior by magnitude |
215
218
  | cells | 64,273 whole (compacted) + 465,702 partial = **529,975** rows, at resolutions 6/7/8/9/10 · 0 features coarsened |
@@ -221,7 +224,7 @@ The full national build on this lab, at the chosen resolution 10 with coverage a
221
224
  | verify (positive) | **48/48 agree** with the live service · 0 within boundary tolerance · 0 disagree · 0 local-code mismatches |
222
225
  | verify (negative) | **6/6** Donegal and Northern Irish points read `unknown` with no designation |
223
226
 
224
- ## Building it
227
+ ## Build it
225
228
 
226
229
  ```bash
227
230
  # The whole country. Downloads the 247 MB export on the first run and caches it under its vintage.
@@ -234,23 +237,24 @@ mailwoman gazetteer build zoning --export <path> --authority SD
234
237
  mailwoman gazetteer build zoning --export <path> --measure-resolutions 9,10,11 --offline
235
238
  ```
236
239
 
237
- The build is **batched**: one child process per range of the authority's own feature ids, because h3's WASM
238
- heap cannot be reset from JavaScript and does not survive an unbounded number of polyfill calls. This product's
239
- 85,330 features fit inside the 100,000-id default, and the bound ships anyway — a build that stays inside a
240
- ceiling by luck is not the same fact as one that cannot cross it.
240
+ The build is **batched**, with one child process per range of the authority's own feature ids. h3's WASM heap
241
+ cannot be reset from JavaScript and fails after an unbounded number of polyfill calls. This product's 85,330
242
+ features fit inside the 100,000-id default, but the bound ships anyway, because it guarantees the limit instead
243
+ of relying on the current feature count.
241
244
 
242
245
  ## Verification
243
246
 
244
247
  `--verify` runs both halves against the Department's own feature service.
245
248
 
246
- **Positive half.** A deterministic sample of interior points, spread across authorities, answered from the
247
- sealed artifact and then re-asked of the live service. The service's rings get the SAME hole-role resolution
248
- the ingest gave the archive's, so what is compared is a verdict against a verdict. A point within half a meter
249
- of a service-polygon edge is reported as `boundary_tolerance` rather than as a disagreement, with its distance
250
- **to the nearest edge** — a point a centimeter from a long edge can be meters from every vertex of it.
249
+ **Positive half.** The check answers a deterministic sample of interior points, spread across authorities, from
250
+ the sealed artifact and then asks the live service about the same points. The service's rings get the same
251
+ hole-role resolution that the ingest applied to the archive's rings, so the check compares one verdict against
252
+ another. A point within half a meter of a service-polygon edge is reported as `boundary_tolerance` instead of a
253
+ disagreement, together with its distance **to the nearest edge**. A point a centimeter from a long edge can be
254
+ meters from every vertex of that edge.
251
255
 
252
- **Negative half, and it matters more here than for any sibling layer.** Donegal points and Northern Irish
253
- points must come back `unknown` with no designation. A positive-only check would pass on an artifact that
256
+ **Negative half. This half matters more here than for any sibling layer.** Donegal points and Northern Irish
257
+ points must return `unknown` with no designation. A positive-only check would pass on an artifact that
254
258
  reported the whole island as zoned.
255
259
 
256
260
  ## License and posture
@@ -265,49 +269,51 @@ reported the whole island as zoned.
265
269
  3. `myplan.ie`'s own disclaimer grants distribution and commercial use, and points at a map-viewer splash
266
270
  screen for the operative terms.
267
271
 
268
- A shipped layer needs one grant it can quote, and this record does not have one. So:
272
+ A shipped layer needs one grant that it can quote, and this record does not have one. As a result:
269
273
 
270
- - `layer_manifest.license` is **`NOASSERTION`** — SPDX's own token for a determination nobody has made. Writing
271
- `CC-BY-4.0` there while an all-rights-reserved clause names a licensor would be this program asserting a
272
- grant.
274
+ - `layer_manifest.license` is **`NOASSERTION`**, SPDX's own token for a determination nobody has made. A `CC-BY-4.0` value
275
+ `CC-BY-4.0` there while an all-rights-reserved clause identifies a licensor would mean this program asserting
276
+ a grant.
273
277
  - `layer_manifest.tier` is **`build-local`**, and `assertTierMatchesLicense` refuses a `shipped` build while the
274
- license reads `NOASSERTION`. Moving the tier takes a deliberate edit at a line that names what is unresolved.
275
- - `layer_manifest.attribution` carries **both halves** — the Department's credit line and the Tailte Éireann
276
- clause — because a re-user who saw only the first would not know the second exists.
278
+ license reads `NOASSERTION`. A tier change requires a deliberate edit at a line that states what is
279
+ unresolved.
280
+ - `layer_manifest.attribution` carries **both parts**, the Department's credit line and the Tailte Éireann
281
+ clause, because a re-user who saw only the first would not know that the second exists.
277
282
 
278
- **What would change it:** the myplan.ie disclaimer names a fourth statement as authoritative ("For full details
279
- of conditions of use please see map viewer splash screen"), and that splash text was not retrieved. Two ArcGIS
280
- instant-app configurations linked from the viewer page were read and neither is the zoning viewer's. That is
281
- the single fact that would move this layer from `build-local` to `shipped`.
283
+ **What would change it:** The myplan.ie disclaimer points to a fourth statement as authoritative ("For full
284
+ details of conditions of use please see map viewer splash screen"), and that splash text was not retrieved. Two
285
+ ArcGIS instant-app configurations linked from the viewer page were read, and neither belongs to the zoning
286
+ viewer. The splash text is the single fact that would move this layer from `build-local` to `shipped`.
282
287
 
283
- The npm side holds nothing: `@mailwoman/zoning` publishes with every release from `.release-it.json`'s
284
- workspace list. The `build-local` tier is a statement about the DATA alone.
288
+ The npm package is unaffected. `@mailwoman/zoning` publishes with every release from `.release-it.json`'s
289
+ workspace list. The `build-local` tier applies to the data alone.
285
290
 
286
291
  ## The mapped-footprint question — what is settled, and what would change it
287
292
 
288
- `zoning_mapped_extent` ships **empty**, and its emptiness is the claim. The Department states "Awaiting data for
289
- some Local Authorities - please see map viewer for coverage details" and publishes that detail only inside a map
290
- application. Donegal's absence was recovered by measuring `LA_CODE`, not read from a coverage statement, and
291
- whether other authorities are partially rather than wholly represented is unknown.
293
+ `zoning_mapped_extent` ships **empty**, which records that no mapped footprint is known. The Department states
294
+ "Awaiting data for some Local Authorities - please see map viewer for coverage details" and publishes that
295
+ detail only inside a map application. Donegal's absence was found by measuring `LA_CODE`, not read from a
296
+ coverage statement. It is unknown whether other authorities are only partially represented.
292
297
 
293
- **Deriving a footprint from the union of the zoning polygons is forbidden**, for the same reason the flood layer
294
- forbids it: the union of zoned areas is not the area the authority examined, and the difference is the whole
295
- content of a negative answer. It is not even a stable shape here — one authority's drafting convention moves the
296
- national zoned-area figure by 41%, because Meath County Council zones its entire rural remainder as one 2,232 km²
297
- polygon against 32.5 km² for the next largest in the country.
298
+ **A footprint derived from the union of the zoning polygons is forbidden**, for the same reason the flood layer
299
+ forbids it. The union of zoned areas differs from the area the authority examined, and that difference is
300
+ exactly what a negative answer would need to report. The union is not even a stable shape here. One authority's
301
+ drafting convention changes the national zoned-area figure by 41%, because Meath County Council zones its entire
302
+ rural remainder as one 2,232 km² polygon, against 32.5 km² for the next largest polygon in the country.
298
303
 
299
- What would move this layer from `source_present` to a stronger basis is a published statement of the area the
300
- Department MAPPED, plus its geometry.
304
+ The Department would need to publish a statement of the area it mapped, together with its geometry, before this
305
+ layer could move from `source_present` to a stronger basis.
301
306
 
302
307
  ## Consumer
303
308
 
304
309
  `packages/mailwoman/lib/observations/zoning-route.ts` reads a finished coordinate and records what an adopted plan
305
- assigns there, as one additive `authority_designation` marker with `mechanism: layer:zoning`. **Default off, and
306
- the switch is the presence of `$MAILWOMAN_DATA_ROOT/zoning/zoning-ireland.db`** rather than a boolean. No layer
307
- file, no route, and the geocode result is byte-identical to a build without the field.
310
+ assigns there, as one additive `authority_designation` marker with `mechanism: layer:zoning`. **The route is off
311
+ by default and turns on when `$MAILWOMAN_DATA_ROOT/db/zoning/zoning-ireland.db` exists.** The file's presence is the only switch.
312
+ Without the layer file the route does not run, and the geocode result is byte-identical to a build without the
313
+ field.
308
314
 
309
315
  ## See also
310
316
 
311
- - The survey that produced this layer: `docs/superpowers/specs/2026-08-27-zoning-layer-survey.md`
312
- - The layer contract: `docs/engineering/reference/layer-contract.mdx`
313
- - The runtime-flag register: `docs/engineering/reference/runtime-flags.mdx`
317
+ - The survey that produced this layer: `docs/superpowers/specs/2026-08-27-zoning-layer-survey.md`.
318
+ - The layer interface: `docs/engineering/reference/layer-interface.mdx`.
319
+ - The runtime-flag register: `docs/engineering/reference/runtime-flags.mdx`.