@mailwoman/tiger 5.9.0 → 5.10.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 (80) hide show
  1. package/block-group.ts +4 -4
  2. package/class-code.ts +168 -166
  3. package/constants.ts +35 -28
  4. package/county-subdivision.ts +4 -4
  5. package/county.ts +4 -4
  6. package/files.ts +41 -32
  7. package/functional-status.ts +16 -14
  8. package/geoid.ts +13 -11
  9. package/index.ts +12 -12
  10. package/legal-statistical-area.ts +140 -137
  11. package/out/block-group.d.ts +4 -4
  12. package/out/class-code.d.ts +167 -166
  13. package/out/class-code.d.ts.map +1 -1
  14. package/out/class-code.js +166 -167
  15. package/out/class-code.js.map +1 -1
  16. package/out/constants.d.ts +31 -28
  17. package/out/constants.d.ts.map +1 -1
  18. package/out/constants.js +23 -26
  19. package/out/constants.js.map +1 -1
  20. package/out/county-subdivision.d.ts +4 -4
  21. package/out/county.d.ts +4 -4
  22. package/out/files.d.ts +35 -33
  23. package/out/files.d.ts.map +1 -1
  24. package/out/files.js +19 -21
  25. package/out/files.js.map +1 -1
  26. package/out/functional-status.d.ts +15 -14
  27. package/out/functional-status.d.ts.map +1 -1
  28. package/out/functional-status.js +14 -15
  29. package/out/functional-status.js.map +1 -1
  30. package/out/geoid.d.ts +20 -19
  31. package/out/geoid.d.ts.map +1 -1
  32. package/out/geoid.js +10 -11
  33. package/out/geoid.js.map +1 -1
  34. package/out/index.d.ts +12 -12
  35. package/out/legal-statistical-area.d.ts +138 -137
  36. package/out/legal-statistical-area.d.ts.map +1 -1
  37. package/out/legal-statistical-area.js +137 -138
  38. package/out/legal-statistical-area.js.map +1 -1
  39. package/out/sdk/index.d.ts +4 -4
  40. package/out/sdk/state/TIGERTabulatedBlockEntity.d.ts +1 -2
  41. package/out/sdk/state/TIGERTabulatedBlockEntity.d.ts.map +1 -1
  42. package/out/sdk/state/index.d.ts +3 -3
  43. package/out/state.d.ts +302 -297
  44. package/out/state.d.ts.map +1 -1
  45. package/out/state.js +181 -186
  46. package/out/state.js.map +1 -1
  47. package/out/tabulation-block.d.ts +3 -3
  48. package/out/tabulation-block.d.ts.map +1 -1
  49. package/out/tools/index.d.ts +15 -0
  50. package/out/tools/index.d.ts.map +1 -0
  51. package/out/tools/index.js +15 -0
  52. package/out/tools/index.js.map +1 -0
  53. package/out/tools/race-dots-map.d.ts +29 -5
  54. package/out/tools/race-dots-map.d.ts.map +1 -1
  55. package/out/tools/race-dots-map.js +53 -64
  56. package/out/tools/race-dots-map.js.map +1 -1
  57. package/out/tools/race-dots.d.ts +27 -7
  58. package/out/tools/race-dots.d.ts.map +1 -1
  59. package/out/tools/race-dots.js +85 -89
  60. package/out/tools/race-dots.js.map +1 -1
  61. package/out/tools/serve-range.d.ts +23 -4
  62. package/out/tools/serve-range.d.ts.map +1 -1
  63. package/out/tools/serve-range.js +47 -36
  64. package/out/tools/serve-range.js.map +1 -1
  65. package/out/tract.d.ts +3 -3
  66. package/out/tract.d.ts.map +1 -1
  67. package/out/tsconfig.tsbuildinfo +1 -1
  68. package/package.json +31 -6
  69. package/sdk/fetch.ts +2 -2
  70. package/sdk/index.ts +4 -4
  71. package/sdk/redistricting.ts +2 -2
  72. package/sdk/state/index.ts +3 -3
  73. package/state.ts +193 -183
  74. package/tabulation-block.ts +20 -20
  75. package/tools/index.ts +15 -0
  76. package/tools/race-dots-map.ts +79 -70
  77. package/tools/race-dots.ts +127 -104
  78. package/tools/serve-range.ts +69 -38
  79. package/tract.ts +12 -12
  80. package/tsconfig.json +2 -1
package/constants.ts CHANGED
@@ -4,8 +4,8 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  */
6
6
 
7
- import { TIGERClassCode } from "./class-code.js"
8
- import { TIGERFunctionalStatus } from "./functional-status.js"
7
+ import { TIGERClassCode } from "./class-code.ts"
8
+ import { TIGERFunctionalStatus } from "./functional-status.ts"
9
9
  import {
10
10
  type FIPSBlockCode,
11
11
  type FIPSBlockGroupCode,
@@ -15,9 +15,9 @@ import {
15
15
  type FIPSPlaceCode,
16
16
  type FIPSTractCode,
17
17
  GeoIDPart,
18
- } from "./geoid.js"
19
- import { LegalStatisticalAreaDescription } from "./legal-statistical-area.js"
20
- import { FIPSStateCode } from "./state.js"
18
+ } from "./geoid.ts"
19
+ import { LegalStatisticalAreaDescription } from "./legal-statistical-area.ts"
20
+ import { FIPSStateCode } from "./state.ts"
21
21
 
22
22
  /**
23
23
  * A code indicating the classification of the block, i.e. urban or rural.
@@ -27,84 +27,91 @@ import { FIPSStateCode } from "./state.js"
27
27
  * @minLength 1
28
28
  * @maxLength 1
29
29
  */
30
- export enum TIGERGeographicClassification {
31
- Urban = "U",
32
- Rural = "R",
33
- }
30
+ export const TIGERGeographicClassification = {
31
+ Urban: "U",
32
+ Rural: "R",
33
+ } as const
34
+
35
+ export type TIGERGeographicClassification =
36
+ (typeof TIGERGeographicClassification)[keyof typeof TIGERGeographicClassification]
34
37
 
35
38
  /**
36
39
  * @title Land/Water Block Type
37
40
  *
38
41
  * A code indicating the type of feature represented by the land/water block.
39
42
  */
40
- export enum LandWaterBlockType {
43
+ export const LandWaterBlockType = {
41
44
  /**
42
45
  * Block is land.
43
46
  */
44
- Land = "L",
47
+ Land: "L",
45
48
  /**
46
49
  * Block is water.
47
50
  */
48
- Water = "W",
49
- }
51
+ Water: "W",
52
+ } as const
53
+
54
+ export type LandWaterBlockType = (typeof LandWaterBlockType)[keyof typeof LandWaterBlockType]
50
55
 
51
56
  /**
52
57
  * @title TIGER Property
53
58
  */
54
- export enum TIGERProperty {
59
+ export const TIGERProperty = {
55
60
  /**
56
61
  * @title Geographic Identifier
57
62
  */
58
- GeoID = "GEOID",
63
+ GeoID: "GEOID",
59
64
  /**
60
65
  * @title Display Name
61
66
  */
62
- DisplayName = "display_name",
67
+ DisplayName: "display_name",
63
68
  /**
64
69
  * @title Urban/Rural Code
65
70
  */
66
- UrbanRuralCode = "urban_rural_code",
71
+ UrbanRuralCode: "urban_rural_code",
67
72
  /**
68
73
  * @title Urban Area Code
69
74
  */
70
- UrbanizedAreaCode = "urbanized_area_code",
75
+ UrbanizedAreaCode: "urbanized_area_code",
71
76
  /**
72
77
  * @title Land Area (square meters)
73
78
  */
74
- LandAreaSqm = "land_area_sqm",
79
+ LandAreaSqm: "land_area_sqm",
75
80
  /**
76
81
  * @title Water Area (square meters)
77
82
  */
78
- WaterAreaSqm = "water_area_sqm",
83
+ WaterAreaSqm: "water_area_sqm",
79
84
  /**
80
85
  * @title Housing Unit Count
81
86
  */
82
- HousingUnitCount = "housing_unit_count",
87
+ HousingUnitCount: "housing_unit_count",
83
88
  /**
84
89
  * @title Population Count
85
90
  */
86
- Population = "population",
91
+ Population: "population",
87
92
  /**
88
93
  * @title Functional Status
89
94
  */
90
- FunctionalStatus = "functional_status",
95
+ FunctionalStatus: "functional_status",
91
96
  /**
92
97
  * @title Centroid Latitude
93
98
  */
94
- CentroidLatitude = "latitude",
99
+ CentroidLatitude: "latitude",
95
100
  /**
96
101
  * @title Centroid Longitude
97
102
  */
98
- CentroidLongitude = "longitude",
103
+ CentroidLongitude: "longitude",
99
104
  /**
100
105
  * @title Legal/Statistical Area Description
101
106
  */
102
- LegalStatisticalAreaDescription = "legal_statistical_area_description",
107
+ LegalStatisticalAreaDescription: "legal_statistical_area_description",
103
108
  /**
104
109
  * @title MAF/TIGER Feature Class Code
105
110
  */
106
- ClassCode = "class_code",
107
- }
111
+ ClassCode: "class_code",
112
+ } as const
113
+
114
+ export type TIGERProperty = (typeof TIGERProperty)[keyof typeof TIGERProperty]
108
115
 
109
116
  /**
110
117
  * Properties common to all Census.
@@ -4,10 +4,10 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  */
6
6
 
7
- import type { TIGERClassCode } from "./class-code.js"
8
- import type { TIGERFunctionalStatus } from "./functional-status.js"
9
- import type { LegalStatisticalAreaDescription } from "./legal-statistical-area.js"
10
- import type { AdminLevel1Code } from "./state.js"
7
+ import type { TIGERClassCode } from "./class-code.ts"
8
+ import type { TIGERFunctionalStatus } from "./functional-status.ts"
9
+ import type { LegalStatisticalAreaDescription } from "./legal-statistical-area.ts"
10
+ import type { AdminLevel1Code } from "./state.ts"
11
11
 
12
12
  /**
13
13
  * Census Geographic subdivision of a county.
package/county.ts CHANGED
@@ -4,10 +4,10 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  */
6
6
 
7
- import { TIGERClassCode } from "./class-code.js"
8
- import { TIGERFunctionalStatus } from "./functional-status.js"
9
- import type { LegalStatisticalAreaDescription } from "./legal-statistical-area.js"
10
- import type { AdminLevel1Code } from "./state.js"
7
+ import { TIGERClassCode } from "./class-code.ts"
8
+ import { TIGERFunctionalStatus } from "./functional-status.ts"
9
+ import type { LegalStatisticalAreaDescription } from "./legal-statistical-area.ts"
10
+ import type { AdminLevel1Code } from "./state.ts"
11
11
 
12
12
  /**
13
13
  * @title TIGER County
package/files.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * TIGER Census data utilities.
7
7
  */
8
8
 
9
- import { AdminLevel1Code } from "./state.js"
9
+ import { AdminLevel1Code } from "./state.ts"
10
10
 
11
11
  //#region Constants
12
12
 
@@ -15,57 +15,61 @@ import { AdminLevel1Code } from "./state.js"
15
15
  *
16
16
  * @category Census
17
17
  */
18
- export enum TIGERLevel {
19
- State = "us_state",
20
- County = "county",
21
- CountySubdivision = "cousub",
22
- Tract = "tract",
23
- BlockGroup = "bg",
24
- Block = "tabblock20",
25
- }
18
+ export const TIGERLevel = {
19
+ State: "us_state",
20
+ County: "county",
21
+ CountySubdivision: "cousub",
22
+ Tract: "tract",
23
+ BlockGroup: "bg",
24
+ Block: "tabblock20",
25
+ } as const
26
+
27
+ export type TIGERLevel = (typeof TIGERLevel)[keyof typeof TIGERLevel]
26
28
 
27
29
  /**
28
30
  * File extension for TIGER data files.
29
31
  *
30
32
  * @category Census
31
33
  */
32
- export enum TIGERFileExtension {
34
+ export const TIGERFileExtension = {
33
35
  /**
34
36
  * Feature geometry, i.e. the shape of the geographic area.
35
37
  */
36
- Shape = ".shp",
38
+ Shape: ".shp",
37
39
  /**
38
40
  * Index of the feature geometry for quick access.
39
41
  */
40
- Index = ".shx",
42
+ Index: ".shx",
41
43
  /**
42
44
  * Tabular attribute metadata.
43
45
  */
44
- Attributes = ".dbf",
46
+ Attributes: ".dbf",
45
47
  /**
46
48
  * Coordinate system information. Describes the projection of the geographic data.
47
49
  */
48
- Projection = ".prj",
50
+ Projection: ".prj",
49
51
  /**
50
52
  * Federal Geographic Data Committee (FGDC) metadata.
51
53
  */
52
- FGDCMetadata = ".shp.xml",
54
+ FGDCMetadata: ".shp.xml",
53
55
  /**
54
56
  * International Organization for Standardization (ISO 191) metadata.
55
57
  */
56
- ISOMetadata = ".shp.iso.xml",
58
+ ISOMetadata: ".shp.iso.xml",
57
59
  /**
58
60
  * ISO 191 (entity and attribute) metadata.
59
61
  */
60
- EntityAttributeMetadata = ".shp.ea.iso.xml",
62
+ EntityAttributeMetadata: ".shp.ea.iso.xml",
61
63
 
62
64
  /**
63
65
  * Compressed ZIP archive.
64
66
  */
65
- Zip = ".zip",
67
+ Zip: ".zip",
66
68
 
67
- None = "",
68
- }
69
+ None: "",
70
+ } as const
71
+
72
+ export type TIGERFileExtension = (typeof TIGERFileExtension)[keyof typeof TIGERFileExtension]
69
73
 
70
74
  /**
71
75
  * Order of TIGER levels for processing, from largest to smallest.
@@ -126,7 +130,7 @@ export type TIGERStateLevelZIPPath<
126
130
  SFC extends AdminLevel1Code,
127
131
  Level extends TIGERLevel,
128
132
  Vintage extends number = TIGERCurrentVintage,
129
- > = `/geo/tiger/TIGER${Vintage}/${Uppercase<Level>}/${TIGERStateLevelFileName<SFC, Level, TIGERFileExtension.Zip, Vintage>}`
133
+ > = `/geo/tiger/TIGER${Vintage}/${Uppercase<Level>}/${TIGERStateLevelFileName<SFC, Level, typeof TIGERFileExtension.Zip, Vintage>}`
130
134
 
131
135
  /**
132
136
  * Template function to generate a TIGER ZIP file path.
@@ -176,13 +180,18 @@ export interface TIGERLevelManifest<
176
180
  Level extends TIGERLevel,
177
181
  Vintage extends number = number,
178
182
  > {
179
- Shape: TIGERStateLevelFileName<SFC, Level, TIGERFileExtension.Shape, Vintage>
180
- Index: TIGERStateLevelFileName<SFC, Level, TIGERFileExtension.Index, Vintage>
181
- Attributes: TIGERStateLevelFileName<SFC, Level, TIGERFileExtension.Attributes, Vintage>
182
- Projection: TIGERStateLevelFileName<SFC, Level, TIGERFileExtension.Projection, Vintage>
183
- FGDCMetadata: TIGERStateLevelFileName<SFC, Level, TIGERFileExtension.FGDCMetadata, Vintage>
184
- ISOMetadata: TIGERStateLevelFileName<SFC, Level, TIGERFileExtension.ISOMetadata, Vintage>
185
- EntityAttributeMetadata: TIGERStateLevelFileName<SFC, Level, TIGERFileExtension.EntityAttributeMetadata, Vintage>
183
+ Shape: TIGERStateLevelFileName<SFC, Level, typeof TIGERFileExtension.Shape, Vintage>
184
+ Index: TIGERStateLevelFileName<SFC, Level, typeof TIGERFileExtension.Index, Vintage>
185
+ Attributes: TIGERStateLevelFileName<SFC, Level, typeof TIGERFileExtension.Attributes, Vintage>
186
+ Projection: TIGERStateLevelFileName<SFC, Level, typeof TIGERFileExtension.Projection, Vintage>
187
+ FGDCMetadata: TIGERStateLevelFileName<SFC, Level, typeof TIGERFileExtension.FGDCMetadata, Vintage>
188
+ ISOMetadata: TIGERStateLevelFileName<SFC, Level, typeof TIGERFileExtension.ISOMetadata, Vintage>
189
+ EntityAttributeMetadata: TIGERStateLevelFileName<
190
+ SFC,
191
+ Level,
192
+ typeof TIGERFileExtension.EntityAttributeMetadata,
193
+ Vintage
194
+ >
186
195
  }
187
196
 
188
197
  export function TIGERLevelManifest<
@@ -222,10 +231,10 @@ export function TIGERLevelManifest<
222
231
  * A full TIGER manifest for a specific state.
223
232
  */
224
233
  export interface TIGERStateManifest<SFC extends AdminLevel1Code, Vintage extends number = TIGERCurrentVintage> {
225
- Tract: TIGERLevelManifest<SFC, TIGERLevel.Tract, Vintage>
226
- CountySubdivision: TIGERLevelManifest<SFC, TIGERLevel.CountySubdivision, Vintage>
227
- BlockGroup: TIGERLevelManifest<SFC, TIGERLevel.BlockGroup, Vintage>
228
- Block: TIGERLevelManifest<SFC, TIGERLevel.Block, Vintage>
234
+ Tract: TIGERLevelManifest<SFC, typeof TIGERLevel.Tract, Vintage>
235
+ CountySubdivision: TIGERLevelManifest<SFC, typeof TIGERLevel.CountySubdivision, Vintage>
236
+ BlockGroup: TIGERLevelManifest<SFC, typeof TIGERLevel.BlockGroup, Vintage>
237
+ Block: TIGERLevelManifest<SFC, typeof TIGERLevel.Block, Vintage>
229
238
  }
230
239
 
231
240
  export function TIGERStateManifest<SFC extends AdminLevel1Code, Vintage extends number = TIGERCurrentVintage>(
@@ -9,54 +9,56 @@
9
9
  *
10
10
  * @title TIGER Functional Status
11
11
  */
12
- export enum TIGERFunctionalStatus {
12
+ export const TIGERFunctionalStatus = {
13
13
  /**
14
14
  * Active government providing primary general-purpose functions. Active entity (federally recognized entities only).
15
15
  */
16
- ActiveGovernment = "A",
16
+ ActiveGovernment: "A",
17
17
  /**
18
18
  * Active government that is partially consolidated with another government but with separate officials providing
19
19
  * primary general-purpose functions.
20
20
  */
21
- PartiallyConsolidatedActiveGovernment = "B",
21
+ PartiallyConsolidatedActiveGovernment: "B",
22
22
  /**
23
23
  * Active government consolidated with another government with a single set of officials.
24
24
  */
25
- ActiveGovernmentConsolidated = "C",
25
+ ActiveGovernmentConsolidated: "C",
26
26
  /**
27
27
  * Active government providing special-purpose functions.
28
28
  */
29
- ActiveGovernmentSpecialPurpose = "E",
29
+ ActiveGovernmentSpecialPurpose: "E",
30
30
  /**
31
31
  * Fictitious entity created to fill the Census Bureau geographic hierarchy
32
32
  */
33
- FictitiousEntity = "F",
33
+ FictitiousEntity: "F",
34
34
  /**
35
35
  * Active government that is subordinate to another unit of government.
36
36
  */
37
- SubordinateActiveGovernment = "G",
37
+ SubordinateActiveGovernment: "G",
38
38
  /**
39
39
  * Inactive governmental unit that has the power to provide primary special-purpose functions.
40
40
  */
41
- InActiveGovernmentalUnit = "I",
41
+ InActiveGovernmentalUnit: "I",
42
42
  /**
43
43
  * Inactive, nonfunctioning legal real property entity with potential quasi-legal administrative functions.
44
44
  */
45
- InactiveNonFunctioningLegalRealPropertyEntity = "L",
45
+ InactiveNonFunctioningLegalRealPropertyEntity: "L",
46
46
  /**
47
47
  * Active legal real property entity with quasi-legal functions.
48
48
  */
49
- ActiveLegalRealPropertyEntity = "M",
49
+ ActiveLegalRealPropertyEntity: "M",
50
50
  /**
51
51
  * Non-functioning legal entity.
52
52
  */
53
- NonFunctioningLegalEntity = "N",
53
+ NonFunctioningLegalEntity: "N",
54
54
  /**
55
55
  * Statistical entity.
56
56
  */
57
- StatisticalEntity = "S",
57
+ StatisticalEntity: "S",
58
58
  /**
59
59
  * Active state-recognized entity.
60
60
  */
61
- ActiveStateRecognizedEntity = "T",
62
- }
61
+ ActiveStateRecognizedEntity: "T",
62
+ } as const
63
+
64
+ export type TIGERFunctionalStatus = (typeof TIGERFunctionalStatus)[keyof typeof TIGERFunctionalStatus]
package/geoid.ts CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  import type { Tagged } from "type-fest"
8
8
 
9
- import { AdminLevel1Code, FIPSStateCode } from "./state.js"
9
+ import { AdminLevel1Code, FIPSStateCode } from "./state.ts"
10
10
 
11
11
  //#region Tagged FIPS types
12
12
 
@@ -210,46 +210,48 @@ export type FIPSCongressionalDistrictCode = Tagged<string, "FIPSConressionalDist
210
210
  *
211
211
  * @internal
212
212
  */
213
- export enum GeoIDPart {
213
+ export const GeoIDPart = {
214
214
  /**
215
215
  * The state code part of a GeoID.
216
216
  *
217
217
  * Sometimes considered the administrative area level 1 code.
218
218
  */
219
- State = "state_code",
219
+ State: "state_code",
220
220
  /**
221
221
  * The county code part of a GeoID.
222
222
  *
223
223
  * Sometimes considered the administrative area level 2 code.
224
224
  */
225
- County = "county_code",
225
+ County: "county_code",
226
226
  /**
227
227
  * The county subdivision code part of a GeoID.
228
228
  *
229
229
  * Sometimes considered the administrative area level 3 code.
230
230
  */
231
- CountySubDivision = "county_sub_division_code",
231
+ CountySubDivision: "county_sub_division_code",
232
232
  /**
233
233
  * The congressional district code part of a GeoID.
234
234
  */
235
- CongressionalDistrict = "congressional_district_code",
235
+ CongressionalDistrict: "congressional_district_code",
236
236
  /**
237
237
  * A place as defined by the Census, such as a city or town.
238
238
  */
239
- Place = "place_code",
239
+ Place: "place_code",
240
240
  /**
241
241
  * The tract code part of a GeoID. The third most granular part.
242
242
  */
243
- Tract = "tract_code",
243
+ Tract: "tract_code",
244
244
  /**
245
245
  * The block group code part of a GeoID. The second most granular part.
246
246
  */
247
- BlockGroup = "block_group_code",
247
+ BlockGroup: "block_group_code",
248
248
  /**
249
249
  * The block code part of a GeoID. The most granular part.
250
250
  */
251
- Block = "block_code",
252
- }
251
+ Block: "block_code",
252
+ } as const
253
+
254
+ export type GeoIDPart = (typeof GeoIDPart)[keyof typeof GeoIDPart]
253
255
 
254
256
  /**
255
257
  * Mapping of GeoID parts to their respective FIPS codes types.
package/index.ts CHANGED
@@ -4,15 +4,15 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  */
6
6
 
7
- export * from "./block-group.js"
8
- export * from "./class-code.js"
9
- export * from "./constants.js"
10
- export * from "./county-subdivision.js"
11
- export * from "./county.js"
12
- export * from "./files.js"
13
- export * from "./functional-status.js"
14
- export * from "./geoid.js"
15
- export * from "./legal-statistical-area.js"
16
- export * from "./state.js"
17
- export * from "./tabulation-block.js"
18
- export * from "./tract.js"
7
+ export * from "./block-group.ts"
8
+ export * from "./class-code.ts"
9
+ export * from "./constants.ts"
10
+ export * from "./county-subdivision.ts"
11
+ export * from "./county.ts"
12
+ export * from "./files.ts"
13
+ export * from "./functional-status.ts"
14
+ export * from "./geoid.ts"
15
+ export * from "./legal-statistical-area.ts"
16
+ export * from "./state.ts"
17
+ export * from "./tabulation-block.ts"
18
+ export * from "./tract.ts"