import type { S1ChordAngle } from '../geometry/s1/chordAngle';
import type { Face, FeatureIterator, JSONCollection, MValue, Projection, Properties, RGBA, S2CellId, VectorPoint, VectorPointM } from '..';
import type { VectorStore, VectorStoreConstructor } from '../dataStore';
/** The kind of input required to store a point for proper indexing */
export interface PointShape<M extends MValue = Properties> {
    cell: S2CellId;
    point: VectorPointM<M>;
}
/**
 * # Point Index
 *
 * ## Description
 * An index of cells with radius queries
 * Assumes the data is compatible with {@link https://open-s2.github.io/s2json/types/Properties.html}
 *
 * ## Usage
 * ```ts
 * import { PointIndex } from 'gis-tools-ts';
 * import { FileVector } from 'gis-tools-ts/file';
 *
 * const pointIndex = new PointIndex();
 * // or used a file based store
 * const pointIndex = new PointIndex(FileVector);
 *
 * // insert a lon-lat
 * pointIndex.insertLonLat(lon, lat, data);
 * // insert an STPoint
 * pointIndex.insertFaceST(face, s, t, data);
 *
 * // after adding data build the index. NOTE: You don't have to call this, it will be called
 * // automatically when making a query
 * await pointIndex.sort();
 *
 * // you can search a range
 * const points = await pointIndex.searchRange(low, high);
 * // or a radius
 * const points = await pointIndex.searchRadius(center, radius);
 * ```
 */
export declare class PointIndex<M extends MValue = Properties | RGBA> {
    #private;
    private projection;
    /**
     * @param store - the store to index. May be an in memory or disk
     * @param projection - the projection of the data, defaults to S2
     */
    constructor(store?: VectorStoreConstructor<PointShape<M>>, projection?: Projection);
    /**
     * Set the index store to a defined one. Useful for file based stores where we want to reuse data
     * @param store - the index store
     */
    setStore(store: VectorStore<PointShape<M>>): void;
    /**
     * Insert a cell with the point and its corresponding data to the index
     * @param cell - the cell id to be indexed
     * @param point - the point to be indexed
     */
    insertID(cell: S2CellId, point: VectorPointM<M>): void;
    /**
     * Insert a point3D and its corresponding data to the index
     * @param point - the point to be indexed
     */
    insert(point: VectorPointM<M>): void;
    /**
     * Add all points from a reader. It will try to use the M-value first, but if it doesn't exist
     * it will use the feature properties data
     * @param reader - a reader containing the input data
     */
    insertReader(reader: FeatureIterator<unknown, M, M>): Promise<void>;
    /**
     * Add a vector feature. It will try to use the M-value first, but if it doesn't exist
     * it will use the feature properties data
     * @param data - any source of data like a feature collection or features themselves
     */
    insertFeature(data: JSONCollection<unknown, M, M>): void;
    /**
     * Add a lon-lat pair to the cluster
     * @param ll - lon-lat vector point in degrees
     */
    insertLonLat(ll: VectorPoint<M>): void;
    /**
     * Insert an STPoint to the index
     * @param face - the face of the cell
     * @param s - the s coordinate
     * @param t - the t coordinate
     * @param data - the data associated with the point
     */
    insertFaceST(face: Face, s: number, t: number, data: M): void;
    /**
     * iterate through the points
     * @yields a PointShape<T>
     */
    [Symbol.asyncIterator](): AsyncGenerator<PointShape<M>>;
    /** Sort the index in place if unsorted */
    sort(): Promise<void>;
    /**
     * Find the starting index of a search
     * @param id - input id to seek the starting index of the search
     * @returns the starting index
     */
    lowerBound(id: S2CellId): Promise<number>;
    /**
     * Search for points given a range of low and high ids
     * @param low - the lower bound. If high is not provided, the low-high range will be created from the low
     * @param high - the upper bound
     * @param maxResults - the maximum number of results to return
     * @returns the points in the range
     */
    searchRange(low: S2CellId, high?: S2CellId, maxResults?: number): Promise<PointShape<M>[]>;
    /**
     * TODO: Adjust the radius for the WM projection. Really not a massive issue thogh just adjust your calcuation for now
     * Search for points within a given radius of a target point
     * @param target - the point to search
     * @param radius - the search radius
     * @param maxResults - the maximum number of results
     * @returns the points within the radius
     */
    searchRadius(target: VectorPoint, radius: S1ChordAngle, maxResults?: number): Promise<PointShape<M>[]>;
}
//# sourceMappingURL=pointIndex.d.ts.map