s2-tools
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
62 lines • 2.16 kB
TypeScript
import type { Stringifiable } from '..';
import type { KDKV, KDStore } from '.';
/** Options to create a S2FileStore */
export interface MMapOptions {
/** If true, then the values are stored in the index section of the keys file */
valuesAreIndex?: boolean;
/** The maximum heap size in bytes for each grouping of data. */
maxHeap?: number;
/** If desired, a temporary directory to use */
tmpDir?: string;
}
/** A local KD key-value store */
export declare class KDMMapSpatialIndex<T = Stringifiable> implements KDStore<T> {
#private;
private readonly nodeSize;
readonly fileName: string;
/**
* @param nodeSize - the size of each kd-tree node
* @param fileName - the path + file name without the extension
* @param options - the options of how the store should be created and used
*/
constructor(nodeSize?: number, fileName?: string, options?: MMapOptions);
/** @returns - the length of the store */
get length(): number;
/**
* Adds a value to be associated with a key
* @param value - the value to store
*/
push(value: KDKV<T>): void;
/**
* Gets a value from the store at index
* @param index - the position in the store
* @returns - the value
*/
get(index: number): KDKV<T>;
/**
* Get a range of values
* @param indexStart - the start index
* @param indexEnd - the end index
* @returns - the values
*/
getRange(indexStart: number, indexEnd: number): KDKV<T>[];
/**
* Iterates over all values in the store
* @param bigint - set to true if the value is a bigint stored in the index
* @yields an iterator
*/
values(bigint?: boolean): Generator<KDKV<T>>;
/**
* iterate through the values
* @returns an iterator
*/
[Symbol.iterator](): Generator<KDKV<T>>;
/**
* Closes the store
* @param cleanup - set to true if you want to remove the .keys and .values files upon closing
*/
close(cleanup?: boolean): void;
/** Sort the store using the Floyd-Rivest selection algorithm */
sort(): void;
}
//# sourceMappingURL=mmap.d.ts.map