/** * Fetches the Populated Places layer of the USGS National Map geonames MapServer: the Geographic * Names Information System's populated places, one per GNIS id, in every state and territory. * * A work of the United States Government, public domain under 17 U.S.C. ยง 105. * * The layer answers at most 2,000 features per request, and `pageArcGISLayer` pages it by `OBJECTID`. * Each place is written as one JSON line: its GNIS id, name, feature class, state, county and point. * * The layer stores a place's point as a one-point multipoint, and the fetcher writes that point. * * The service description is saved beside the places as `service.json`. * Its `copyrightText` states the publisher's refresh date. * * Invoke via `mailwoman corpus fetch usgs-gnis`. */ import { APIClient } from "@mailwoman/core/api"; import { type PathBuilderLike } from "path-ts"; import type { BaseFetchOptions, FetchSummary, SourceManifest } from "#tools/fetch/download"; /** * The directory a fetch writes under, below the fetch root. */ export declare const USGS_GNIS_SLUG = "usgov-usgs-gnis"; /** * The geonames MapServer. */ export declare const USGS_GNIS_SERVICE_URL = "https://carto.nationalmap.gov/arcgis/rest/services/geonames/MapServer"; /** * The Populated Places layer of {@link USGS_GNIS_SERVICE_URL}. */ export declare const USGS_GNIS_POPULATED_PLACES_LAYER = 3; /** * The service's `maxRecordCount`: the most features one query returns. */ export declare const USGS_GNIS_PAGE_SIZE = 2000; /** * The layer fields the fetcher asks for, in the service's spelling. */ export declare const USGS_GNIS_FIELDS: readonly ["OBJECTID", "gaz_id", "gaz_name", "gaz_featureclass", "fcode", "state_alpha", "county_name", "incounty_id", "isunknowncoords"]; /** * The file the places are written to. */ export declare const USGS_GNIS_PLACES_FILENAME = "populated-places.jsonl"; /** * The file the service description is saved to, beside the places. */ export declare const USGS_GNIS_SERVICE_FILENAME = "service.json"; /** * One GNIS populated place as the fetch writes it. */ export interface GNISPopulatedPlace { gnisID: number; name: string; featureClass: string | null; fcode: number | null; /** * The USPS state or territory code. */ state: string | null; county: string | null; /** * The GNIS id of the county the place lies in. */ countyGNISID: number | null; /** * Whether GNIS marks the place's coordinates as unknown. */ unknownCoordinates: boolean; longitude: number | null; latitude: number | null; } /** * What one run recorded. * * `publisher_version` is the service's `copyrightText`, which states its refresh. */ export interface USGSGNISManifest extends SourceManifest { service_url: string; layer_id: number; feature_count: number; } /** * One service feature as a {@link GNISPopulatedPlace}. * * @throws When the value isn't a GeoJSON feature, or has no GNIS id or name. */ export declare function normalizeGNISFeature(value: unknown): GNISPopulatedPlace; /** * Per-invocation options. */ export interface DownloadUSGSGNISOptions { outputDir: PathBuilderLike; signal?: AbortSignal; report?: (line: string) => void; } /** * Pages the Populated Places layer into `/populated-places.jsonl` and writes the manifest. * * The places are written to a staging file. * The file moves into place only once the pull holds the feature count the service stated. * A failed run leaves the previous file as it was. */ export declare function downloadUSGSGNIS(client: Pick, options: DownloadUSGSGNISOptions): Promise; /** * The path a fetch under `outRoot` writes the places to. */ export declare function usgsGNISPlacesPath(outRoot: BaseFetchOptions["outRoot"]): PathBuilderLike; /** * Per-invocation options for the registry entry. */ export interface FetchUSGSGNISOptions extends BaseFetchOptions { signal?: AbortSignal; } /** * The registry entry. */ export declare function fetchUSGSGNIS(options: FetchUSGSGNISOptions, report?: (line: string) => void): Promise; //# sourceMappingURL=gnis.d.ts.map