@robinpath/geo
v0.1.0
Published
> Geolocation utilities: distance, bearing, geocoding, bounding box, polygon containment, DMS conversion
Keywords
Readme
@robinpath/geo
Geolocation utilities: distance, bearing, geocoding, bounding box, polygon containment, DMS conversion
Why use this module?
The geo module lets you:
- Haversine distance between two points
- Bearing between two points
- Midpoint between two coordinates
- Destination point given start, bearing, and distance
- Bounding box around a point
All functions are callable directly from RobinPath scripts with a simple, consistent API.
Installation
npm install @robinpath/geoQuick Start
No credentials needed — start using it right away:
geo.bearing 40.7128 -74.0060 51.5074 -0.1278Available Functions
| Function | Description |
|----------|-------------|
| geo.distance | Haversine distance between two points |
| geo.bearing | Bearing between two points |
| geo.midpoint | Midpoint between two coordinates |
| geo.destination | Destination point given start, bearing, and distance |
| geo.boundingBox | Bounding box around a point |
| geo.isInBoundingBox | Check if point is inside bounding box |
| geo.toRadians | Convert degrees to radians |
| geo.toDegrees | Convert radians to degrees |
| geo.toDMS | Convert decimal degrees to DMS string |
| geo.fromDMS | Parse DMS string to decimal degrees |
| geo.geocode | Forward geocode address to coordinates |
| geo.reverseGeocode | Reverse geocode coordinates to address |
| geo.polygon | Check if point is inside polygon |
| geo.area | Calculate polygon area in sq km |
Examples
Bearing between two points
geo.bearing 40.7128 -74.0060 51.5074 -0.1278Midpoint between two coordinates
geo.midpoint 40.7128 -74.0060 51.5074 -0.1278Destination point given start, bearing, and distance
geo.destination 40.7128 -74.0060 45 100Integration with RobinPath
import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/geo";
const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);
const result = await rp.executeScript(`
geo.bearing 40.7128 -74.0060 51.5074 -0.1278
`);Full API Reference
See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.
Related Modules
@robinpath/json— JSON module for complementary functionality
License
MIT
