sun-horizon 🌄
🌄 Get Horizon profile based on topography from a (latitude, longitude) point.
🙌🏻 This module is heavily based on node-hgt.
☕️ Support
🏁 Install
npm install sun-horizon
🏃♂️ Usage
✅ Call init() function before any other operations.
🗄 sun-horizon uses a cache directory of HGT files (default sun-horizon-data/
).
💻 This module supports javascript or typescirpt.
const sunHorizon = ; sunHorizon;const horizon = await sunHorizon;
or
; init;;
Types
LatLng
HorizonOptions
AzimuthOptions
HighestPointOptions
HorizonPoint
Horizon
CacheData
Functions
init
initcacheDirectory?: string: void
Initialize module and create the required cache directory (default is sun-horizon-data/
) + populate with a .gitignore
file.
getHorizon
getHorizonorigin: LatLng, options?: HorizonOptions: Promise<Horizon>
;console.loghorizon.elevationProfile.mappoint.altitude;
highestPointInAzimuth
highestPointInAzimuthorigin: LatLng, azimuth: number, options?: HighestPointOptions: Promise<HorizonPoint>
; // East;
getAltitude
getAltitudelatLng: LatLng: Promise<number>
; // in meter
getCacheData
Return number of files and total size in bytes
. (See CacheData)
getCacheData: Promise<CacheData>
;
cleanCache
Delete all .hgt cache files and return number of deleted files.
cleanCache: Promise<number>
;