Calculate 360-degree horizon elevation angles from elevation data
npm install @bridgerb/horizon- Node.js 22+
- GDAL (brew install gdal / apt install gdal-bin)
``bash`
npm install @bridgerb/horizon gdal-async
`typescript
import { loadElevationData } from "@bridgerb/horizon";
const elevation = await loadElevationData("path/to/elevation.tif");
const horizon = elevation.calculateHorizon(40.311259, -111.659330);
// Returns 360 results, one per degree
const partial = elevation.calculateHorizon(40.311259, -111.659330, 45, 135);
// Only directions 45° to 135°
`
Loads a GeoTIFF elevation file. Call once, then query many times.
- lat - Latitude in degreeslng
- - Longitude in degreesstart
- - Start direction (default: 0)end
- - End direction (default: 359)
- direction - Compass direction in degrees (0 = North)elevationAngleDegrees
- - Angle to horizondistance_km` - Distance to horizon point
-
Unlicense - Public Domain