@seasketch/geoprocessing
Version:
Geoprocessing and reporting framework for SeaSketch 2.0
32 lines (31 loc) • 1.89 kB
TypeScript
import { Metric, Datasource, Geography, VectorDatasource } from "../../../src/types/index.js";
import ProjectClientBase from "../../../src/project/ProjectClientBase.js";
export interface PrecalcDatasourceOptions {
/** Alternative path to look for datasources than default if using internal.*/
newDatasourcePath?: string;
/** Alternative path to look for geographes than default. useful for testing */
newGeographyPath?: string;
/** Alternative path to store precalc data. useful for testing */
newPrecalcPath?: string;
/** Alternative dist path. useful for testing */
newDstPath?: string;
/** array of datasource ID's to precalc, for all geographies. Defaults to "*"" as matcher, which matches on all datasources */
datasourceMatcher?: string[];
/** array of geography ID's to precalc, for all datasources. Defaults to "*" as matcher, which matches on all geographies */
geographyMatcher?: string[];
/** Alternative port to fetch data from */
port?: number;
}
/**
* Precalc one or more datasources for a project, for one or more defined geographies
* one at a time, writing them out to disk as they complete
*/
export declare function precalcDatasources<C extends ProjectClientBase>(projectClient: C, extraOptions?: PrecalcDatasourceOptions): Promise<Metric[]>;
/**
* Precalculate metrics for datasource for given geography and write out to disk
*/
export declare const precalcMetrics: (projectClient: ProjectClientBase, ds: Datasource, geog: Geography, geogDs: VectorDatasource, extraOptions: PrecalcDatasourceOptions) => Promise<Metric[]>;
/**
* returns a function that will filter out metrics that don't match the geographyId or don't have a classId that starts with the datasourceId (total metrics)
*/
export declare const staleMetricsFilterFnFactory: (datasourceId: string, geographyId: string) => (m: Metric) => boolean;