gis-tools-ts
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
69 lines • 1.86 kB
TypeScript
import type { S2CellId } from '../../index.js';
import type { VectorKey, VectorStore } from './index.js';
/**
* # Vector File Store
*
* ## Description
* A filesystem vector store
*
* ## Usage
* ```ts
* import { FileVector } from 'gis-tools-ts/file';
* import type { VectorKey } from 'gis-tools-ts';
*
* interface Data extends VectorKey { name: string };
*
* const vec = new FileVector<Data>();
* // push an entry
* vec.push({ cell: 1n, name: 'test' });
* vec.push({ cell: 1n, name: 'test2' });
* // check if a key exists
* vec.has(1n); // true
* // get length of the store
* console.log(vec.length); // 2
*
* // iterate over the store
* for await (const entry of vec) console.log(entry);
*
* // close the store
* vec.close();
* ```
*/
export declare class FileVector<V extends VectorKey> implements VectorStore<V> {
#private;
/** @param fileName - the path + file name without the extension */
constructor(fileName?: string);
/** @returns the length of the store */
get length(): number;
/**
* Push a value into the store
* @param value - the value to store
*/
push(value: V): void;
/**
* @param index - the position in the store to get the value from
* @returns the value
*/
get(index: number | S2CellId): Promise<V>;
/**
* Check if the key exists
* @param key - the key
* @returns true if the key exists
*/
has(key: number | S2CellId): Promise<boolean>;
/** Sort the store */
sort(): Promise<void>;
/**
* iterate through the values
* @yields {V} - the values iterator
*/
values(): AsyncGenerator<V>;
/**
* iterate through the values
* @returns an iterator
*/
[Symbol.asyncIterator](): AsyncGenerator<V>;
/** Closes the store */
close(): void;
}
//# sourceMappingURL=file.d.ts.map