@seasketch/geoprocessing
Version:
Geoprocessing and reporting framework for SeaSketch 2.0
109 lines (108 loc) • 3.73 kB
TypeScript
import { Datasource, FeatureCollection, Polygon, MultiPolygon } from "../../../src/types/index.js";
/**
* Manage datasources for a geoprocessing project
*/
/** Creates or updates datasource record on disk */
export declare function createOrUpdateDatasource(inputDatasource: Datasource, newDatasourcePath?: string): Promise<Datasource>;
/**
* Reads datasources from disk, validates them, and returns deep copy.
* If datasource file not exist then start a new one and ensure directory exists
*/
export declare function readDatasources(filePath?: string): ({
datasourceId: string;
geo_type: "vector" | "raster";
formats: ("fgb" | "json" | "tif" | "subdivided")[];
precalc: boolean;
classKeys: string[];
src: string;
created: string;
lastUpdated: string;
propertiesToKeep: string[];
explodeMulti: boolean;
metadata?: {
name: string;
version: string;
publisher: string;
publishDate: string;
publishLink: string;
description?: string | undefined;
} | undefined;
idProperty?: string | undefined;
nameProperty?: string | undefined;
propertyFilter?: {
values: (string | number)[];
property: string;
} | undefined;
bboxFilter?: [number, number, number, number] | [number, number, number, number, number, number] | undefined;
layerName?: string | undefined;
} | {
datasourceId: string;
geo_type: "vector" | "raster";
formats: ("fgb" | "json" | "tif" | "subdivided")[];
precalc: boolean;
measurementType: "quantitative" | "categorical";
band: number;
src: string;
created: string;
lastUpdated: string;
metadata?: {
name: string;
version: string;
publisher: string;
publishDate: string;
publishLink: string;
description?: string | undefined;
} | undefined;
noDataValue?: number | undefined;
} | ({
datasourceId: string;
geo_type: "vector" | "raster";
formats: ("fgb" | "json" | "tif" | "subdivided")[];
precalc: boolean;
classKeys: string[];
metadata?: {
name: string;
version: string;
publisher: string;
publishDate: string;
publishLink: string;
description?: string | undefined;
} | undefined;
idProperty?: string | undefined;
nameProperty?: string | undefined;
propertyFilter?: {
values: (string | number)[];
property: string;
} | undefined;
bboxFilter?: [number, number, number, number] | [number, number, number, number, number, number] | undefined;
layerName?: string | undefined;
} & {
url: string;
}) | ({
datasourceId: string;
geo_type: "vector" | "raster";
formats: ("fgb" | "json" | "tif" | "subdivided")[];
precalc: boolean;
measurementType: "quantitative" | "categorical";
band: number;
metadata?: {
name: string;
version: string;
publisher: string;
publishDate: string;
publishLink: string;
description?: string | undefined;
} | undefined;
noDataValue?: number | undefined;
} & {
url: string;
}))[];
export declare function writeDatasources(pd: Datasource[], filePath?: string): void;
/**
* Reads in vector datasource geojson as FeatureCollection
* @param ds internal vector datasource to load features, with geojson format available
* @param dstPath path to directory with datasource
* @returns datasource features
*/
export declare function readDatasourceGeojsonById(datasourceId: string, dstPath: string): FeatureCollection<Polygon | MultiPolygon>;
export declare function readDatasourceFgbById(datasourceId: string, dstPath: string): FeatureCollection<Polygon | MultiPolygon>;