UNPKG

@bitblit/ratchet-common

Version:

Common tools for general use

41 lines (40 loc) 2.22 kB
export declare class GeolocationRatchet { private constructor(); static distanceBetweenLocations(lat1: number, lon1: number, lat2: number, lon2: number, unit?: string): number; static distanceBetweenRatchetGeoLocations(loc1: RatchetGeoLocation, loc2: RatchetGeoLocation, unit?: string): number; static degreeOfLatLngInMiles(latitudeInDecimalDegress?: number): number; static milesInDegLatLng(miles: number, latitudeInDecimalDegress?: number): number; static centerOfBounds(bounds: RatchetLocationBounds): RatchetGeoLocation; private static calculateSplits; static clusterGeoBounds(inputVal: RatchetLocationBounds[], latSlices?: number, lngSlices?: number): RatchetLocationBounds[]; static canonicalizeBounds(inp: RatchetLocationBounds, allowCrossover?: boolean): RatchetLocationBounds; static combineBounds(inp: RatchetLocationBounds[]): RatchetLocationBounds; static roundLocation(r: RatchetGeoLocation, roundDigits: number): RatchetGeoLocation; static locationToBounds(loc: RatchetGeoLocation, radiusMiles: number): RatchetLocationBounds; static sameLocation(loc1: RatchetGeoLocation, loc2: RatchetGeoLocation): boolean; static pointInBounds(pt: RatchetGeoLocation, bound: RatchetLocationBounds): boolean; static pointInAnyBound(pt: RatchetGeoLocation, inBounds: RatchetLocationBounds[], minPointsBeforeMapping?: number): boolean; static pointInRatchetLocationBoundsMap(pt: RatchetGeoLocation, mp: RatchetLocationBoundsMap): boolean; static findRatchetLocationBoundsMapEntry(pt: RatchetGeoLocation, mp: RatchetLocationBoundsMap): RatchetLocationBoundsMapEntry; static buildRatchetLocationBoundsMap(inBounds: RatchetLocationBounds[]): RatchetLocationBoundsMap; } export interface RatchetGeoLocation { lat: number; lng: number; } export interface RatchetLocationBounds { origin: RatchetGeoLocation; extent: RatchetGeoLocation; } export interface RatchetLocationBoundsMap { latOffset: number; lngOffset: number; maxLat: number; maxLng: number; mapping: RatchetLocationBoundsMapEntry[][]; } export interface RatchetLocationBoundsMapEntry { lat: number; lng: number; bounds: RatchetLocationBounds[]; }