/** * @copyright Sister Software. * @license AGPL-3.0 * @author Teffen Ellis, et al. * * Pull TIGER geometry/attributes into a `node:sqlite` database via the Kysely * {@link DatabaseClient}. * * Replaces the ad-hoc wget and the retired corpus TIGER build script. Pared down from isp-nexus's * `generate-tiger-tiles.ts` (its per-level column mapping is the spec) into the playpen * `repo-tools` idiom: an async generator of progress events, idempotent, no SpatiaLite. * * Three levels: * * - `tabblock20` (per state) — tabulation blocks → `tabblock20`, geometry as GeoJSON text. * - `place` (per state) — incorporated/census places → `tiger_places` (attribute-only). * - `addrfeat` (per county) — named street segments + ZIPs → `tiger_streets` (attribute-only). * * `tiger_streets` + `tiger_places` match the schema the corpus `tiger` adapter reads, so this is a * drop-in replacement for the retired corpus TIGER build script. * * Flow per source unit: download (skips a valid cached zip) → unzip → stream `ogr2ogr -f * GeoJSONSeq` (mapping shapefile columns to the schema, WGS84 for geometry levels) → batched * inserts. Re-running a state replaces its rows. */ /** * Supported TIGER levels. `tabblock20` is per state + carries geometry; `place`/`addrfeat` are attribute-only. */ export type TIGERFetchLevel = "tabblock20" | "place" | "addrfeat"; export interface FetchTIGEROptions { /** * Two-digit state FIPS, e.g. `"06"`. */ stateFIPS: string; /** * TIGER level. Default `tabblock20`. */ level?: TIGERFetchLevel; /** * Vintage. Default 2020 for blocks (matches the 2020 P.L.), 2024 for place/addrfeat (current). */ vintage?: number; /** * Output SQLite path. Default `/tiger/tiger.db` (the name the corpus `tiger` adapter reads). */ outPath?: string; /** * Download cache + default output root. */ dataRoot?: string; /** * Optional three-digit county FIPS filter (blocks only — addrfeat is already per-county). */ county?: string; /** * Rows per insert. Default 1000. */ batchSize?: number; } export type FetchTIGEREvent = { phase: "download"; file: string; cached: boolean; } | { phase: "extract"; file: string; } | { phase: "load"; inserted: number; total: number; }; export interface FetchTIGERResult { outPath: string; table: string; inserted: number; } /** * Fetch one state's TIGER data at `level` into a SQLite DB. Yields progress; returns the final tally. */ export declare function fetchTIGER(options: FetchTIGEROptions): AsyncGenerator; //# sourceMappingURL=fetch.d.ts.map