geolocation-utils is a JavaScript/TypeScript library designed for performing various calculations and conversions related to geographical locations. As of its latest stable release, version 1.2.6, published approximately a year ago, the library focuses on providing utility functions rather than direct device geolocation access. It enables conversion between common location formats like `[lon, lat]`, `{lat, lon}`, `{lat, lng}`, and `{latitude, longitude}`. Key functionalities include calculating distances and headings between points, moving a specified distance to a new location, determining bounding boxes around a list of locations, and checking if a location falls within a given polygon, circle, or bounding box. The library differentiates itself by using plain JavaScript objects for locations, which simplifies serialization and interoperability with other libraries and REST APIs. While there isn't a strict major release cadence, development appears active on GitHub with periodic updates.
npm install geolocation-utilsVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage including format conversion, distance calculation, moving to a new point, and checking if a point is within a polygon.
Always double-check the expected order of coordinates for input arrays. Prefer using object-based location formats (e.g., `{lat, lon}`) which are less ambiguous.Standardize on one object format (e.g., `{lat, lon}`) within your application or use the provided conversion utilities (`toLatLon`, `toLatLng`, etc.) explicitly when interacting with external APIs or different data sources.Verify that `LonLatTuple` inputs are strictly in `[longitude, latitude]` order. For example, use `[4, 51]` for 4° Longitude, 51° Latitude. If possible, refactor to use object literals like `{ lat: 51, lon: 4 }` for clearer intent and to prevent this common pitfall.No dependency data recorded yet.