Packages@accelint/geo
Overview
A collection of JavaScript functions for working with coordinates and geospatial data.
Installation
pnpm add @accelint/geoUsage
// Import coordinate utilities
import { createCoordinate, coordinateSystems } from '@accelint/geo';
// Import formatters and parsers
import { formatDecimalDegrees, parseDecimalDegrees } from '@accelint/geo';
import { parseMGRS, parseUTM } from '@accelint/geo';
// Import geodesy functions
import { bearing, distance, greatCirclePoints, midpoint } from '@accelint/geo/geodesy';Available Exports
| Export Path | Description |
|---|---|
| coordinates/coordinate | Parse, validate, convert, and format geographic coordinates across multiple notation systems |
| coordinates/latlon/decimal-degrees | Format and parse latitude/longitude in decimal degrees notation |
| coordinates/latlon/degrees-decimal-minutes | Format and parse coordinates in degrees decimal minutes notation |
| coordinates/latlon/degrees-minutes-seconds | Format and parse coordinates in degrees minutes seconds notation |
| coordinates/mgrs/parser | Parse Military Grid Reference System (MGRS) coordinate strings |
| coordinates/utm/parser | Parse Universal Transverse Mercator (UTM) coordinate strings |
| geodesy | Great-circle bearing, distance, midpoint, and path sampling between two [longitude, latitude] points |
Geodesy
Compute great-circle relationships between two [longitude, latitude] points on a spherical Earth. All geodesy functions take LonLatTuple values (GeoJSON order), which is the reverse of the [latitude, longitude] order used by createCoordinate.
- bearing - Initial bearing in degrees clockwise from true north,
[0, 360) - distance - Distance in meters
- midpoint - Midpoint along the shortest great-circle path
- greatCirclePoints - Evenly spaced vertices along the path, with unwrapped longitudes for drawing
- toSphericalPoints - Shared validation step that returns
LatLonSphericalpoints
Related
- @accelint/constants - Coordinate constants and defaults
- @accelint/predicates - Coordinate validation predicates
- GitHub Repository - Source code