npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

geo-haversine

v1.0.5

Published

[![NPM version](https://img.shields.io/npm/v/geo-haversine.svg)](https://www.npmjs.com/package/geo-haversine) [![NPM license](https://img.shields.io/npm/l/geo-haversine.svg)](https://www.npmjs.com/package/geo-haversine)

Downloads

16

Readme

Geo Haversine

NPM version NPM license

About

Is a pakage that used The Haversine formula to compare distance between two points on Earth using lat/long coordinates. to get the nearests points and get all posisions included in a range.

This is great for use with project that use geolocation api, which provides lat/long coordinates to locate any position near you.

  • getDistance
  • getTheNearestOfTowPoints
  • getTheNearestPoint
  • gettheNearestPointsByRange

Installation

As any npm package you can install geo-haversine using:

$ npm install --save geo-haversine

Or by using yarn :

$ yarn add geo-haversine

Usage

import { GeoHaversine } from "geo-haversine";

const geoHaversine = new GeoHaversine();

Get a couple of latitude/longitude coordinates, then use them as the arguments for the getDistance method to get distance between tow points in a map. Example:

// ---------- [latitude, longitude];
let pos1 = [36.151829, -115.143296];
let pos2 = [35.151465, -45.146284];

const distanceBetweenTowPoints = geoHaversine.getDistance(pos1, pos2);

Get an array of latitude/longitude coordinates, then use them as the arguments for the getTheNearestPoint method to get the nearest point in a map. Example:

// ---------- [latitude, longitude];
let pos1 = [36.151829, -115.143296];
let pos2 = [35.151465, -45.146284];
let pos3 = [16.151465, -53.485613];
.
.
.
let posN = [36.12388, -115.369423];

const theNearestOfTowPoint = geoHaversine.getTheNearestOfTowPoints(pos1,pos2,pos3);

const nearestPoint = geoHaversine.getTheNearestPoint(pos1, pos2, pos3,..., posN);

Get an array of latitude/longitude coordinates, then use them as the arguments for the getTheNearestPoint method to get the nearest point in a map. Example:

// ---------- [latitude, longitude];
let pos1 = [36.151829, -115.143296];
let pos2 = [35.151465, -45.146284];
let pos3 = [16.151465, -53.485613];
.
.
.
let posN = [36.12388, -115.369423];

let posList = [
  [55.3328, -66.325533],
  [54.3328, -6.325533],
  [5.3328, -56.325533],
  [69.3328, 16.325533],
  [55.3328, -66.325593],
]

const range = 14205359; // Distance of radius in meters.

const pointsInRange = geoHaversine.gettheNearestPointsByRange(pos1,range, pos2, pos3,..., posN);
// or
const pointsInRange = geoHaversine.gettheNearestPointsByRange(pos1,range, ...posList);

Support

If you have a feature request, or spotted a bug or a technical problem, create an issue here.

For other questions, contact me.

Licence

This repository is available under the MIT license.

Contact

Feel freee to contact me on my email. or social media Twiter, Github or LinkedIn.