@ogcio/o11y-sdk-node
Version:
Opentelemetry standard instrumentation SDK for NodeJS based project
13 lines (12 loc) • 740 B
TypeScript
export declare const DEFAULT_GEOHASH_PRECISION = 4;
/**
* Encode latitude and longitude into a geohash string.
* Alternates between longitude and latitude bits, bisects the coordinate range, accumulates 5 bits into an index into the BASE32 lookup table, and repeats until the desired precision is reached.
* See https://en.wikipedia.org/wiki/Geohash for algorithm details.
*
* @param lat Latitude (-90 to 90)
* @param lon Longitude (-180 to 180)
* @param precision Number of characters in the geohash (default: 4)
* @returns Geohash string of the given precision, or undefined if inputs are invalid
*/
export declare function encodeGeohash(lat: number | undefined, lon: number | undefined, precision?: number): string | undefined;