New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

geodaisy

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geodaisy

Library for geodesic functions

latest
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

🌎Geodaisy - simple geodesic utilities for NodeJS and Web

Get started

npm install geodaisy

Usage in JavaScript or TypeScript (typings are available):

Distance utilities - Haversine

Uses the Haversine Formula to calculate the distance between two earthly points of coordinates.

import { haversine } from 'geodaisy';

const atlanta = {
  latitude: 33.749,
  longitude: -84.388,
};

const london = {
  latitude: 51.5074,
  longitude: -0.1278,
};

const distance = haversine(
  atlanta.longitude,
  atlanta.latitude,
  london.longitude,
  london.latitude,
);

console.log(distance); // > 6769.949658450232

Distance utilities - distanceWithLatitude

Given a distance as a number (this formula does not care about units) and the distance between the elevation change between two points - calculates the real distance between the two points in a straight line, e.g.:

import { distanceWithLatitude } from 'geodaisy';

const distance = 13800; // m
const elevation = 1120; // m

const realDistance = distanceWithLatitude(distance, elevation);

console.log(realDistance); // > 13845.374678931588

Conversion utilities

The following conversion utilities are also available:

import {
  kmToMile,
  mileToKm,
  yardToMetre,
  metreToYard,
  inchToCm,
  cmToInch,
} from 'geodaisy';

console.log(kmToMile(1)); // > 0.621371
console.log(mileToKm(1)); // > 1.6093444978925633
console.log(yardToMetre(1)); // > 0.9144
console.log(metreToYard(1)); // > 1.0936132983377078
console.log(inchToCm(1)); // > 2.54
console.log(cmToInch(1)); // > 0.39370078740157477

Missing features

The following features I'd love to have in this library but just don't have the time to implement yet. If you'd like to help, feel free to contribute!

  • Bearing calculation
  • Destination point calculation
  • Intersection calculation
  • Path finding
  • Closest point to the poles
  • Rhumb lines
  • Vincenty's formula

Keywords

geolocation

FAQs

Package last updated on 20 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts