s2-tools
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
50 lines • 1.65 kB
TypeScript
import type { Face, Point3D } from '../geometry';
/**
* An S2CellId is a 64-bit unsigned integer that uniquely identifies a cell in the S2
* cell decomposition. Built to interface with internal wasm functions.
* The Id in this case is just the index pointing to the structure in wasm
*/
export type S2CellId = number;
/**
* An S2Cell contains all the information needed to uniquely identify a cell in the S2
*/
export interface S2Cell {
id: S2CellId;
compare: (other: S2Cell) => -1 | 0 | 1;
}
/**
* An S2CellIdComparitor compares two S2CellIds and finds which is smaller
*/
export type WasmS2CellIdComparitor = (id1: S2CellId, id2: S2CellId) => -1 | 0 | 1;
/**
* Generator that builds S2Cells from either lon/lat, S2Point, or face/s/t
*/
export declare class S2CellGenerator {
#private;
instance: WebAssembly.Instance;
wasmMemory?: Uint8Array;
tmpString: string;
/**
* Creates an instance of S2CellGenerator that manages the wasm memory
*/
constructor();
/**
* @param lon - longitude
* @param lat - latitude
* @returns - an S2Cell with the appropriate id and functions
*/
fromLonLat(lon: number, lat: number): S2Cell;
/**
* @param point - a vector point on the sphere
* @returns - an S2Cell with the appropriate id and functions
*/
fromS2Point(point: Point3D): S2Cell;
/**
* @param face - face on the sphere
* @param s - x position
* @param t - y position
* @returns - an S2Cell with the appropriate id and functions
*/
fromFaceST(face: Face, s: number, t: number): S2Cell;
}
//# sourceMappingURL=s2cell.d.ts.map