# geolocation-distances

> A singleton exposing common geolocation methods related to distances.

Latest version **2.0.2** (published 2015-12-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install geolocation-distances
pnpm add geolocation-distances
yarn add geolocation-distances
bun add geolocation-distances
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2015-12-29 |
| First published | 2015-12-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Vidul Nikolaev Petrov |
| Maintainers | vidul |
| Keywords | geolocation, distance |

## Links

- npm: https://www.npmjs.com/package/geolocation-distances
- npm.io page: https://npm.io/package/geolocation-distances

## Recent versions

- 2.0.2 (latest) — 2015-12-29
- 2.0.1 — 2015-12-27
- 2.0.0 — 2015-12-27

## README

## Members

<dl>
<dt><a href="#Constant">Constant</a></dt>
<dd></dd>
</dl>

## Functions

<dl>
<dt><a href="#getDistance">getDistance(location1, location2)</a> ⇒ <code>Number</code></dt>
<dd><p>Find distance between two geolocations.</p>
</dd>
<dt><a href="#getNearLocationsBorder">getNearLocationsBorder(center, distance)</a> ⇒ <code>Object</code></dt>
<dd><p>Find lat/lng min/max within given distance.</p>
</dd>
<dt><a href="#getNearLocations">getNearLocations(center, results, distance)</a> ⇒ <code>Array.&lt;Object&gt;</code></dt>
<dd><p>Filter lat/lng by getDistance,
so that only the cirle area matches stay.</p>
</dd>
</dl>

<a name="Constant"></a>
## Constant
**Kind**: global variable  
**Summary**: A singleton exposing common geolocation methods related to distances.  
**Author:** Vidul Nikolaev Petrov  
<a name="getDistance"></a>
## getDistance(location1, location2) ⇒ <code>Number</code>
Find distance between two geolocations.

**Kind**: global function  
**Returns**: <code>Number</code> - kilometers  

| Param | Type | Description |
| --- | --- | --- |
| location1 | <code>Object</code> | the 1st geolocation |
| location2 | <code>Object</code> | the 2nd geolocation |

<a name="getNearLocationsBorder"></a>
## getNearLocationsBorder(center, distance) ⇒ <code>Object</code>
Find lat/lng min/max within given distance.

**Kind**: global function  
**Returns**: <code>Object</code> - min/max latitude and min/max longitude  

| Param | Type | Description |
| --- | --- | --- |
| center | <code>Object</code> | the center object with lat/lng |
| distance | <code>Number</code> | distance in kilometers |

<a name="getNearLocations"></a>
## getNearLocations(center, results, distance) ⇒ <code>Array.&lt;Object&gt;</code>
Filter lat/lng by getDistance,
so that only the cirle area matches stay.

**Kind**: global function  

| Param | Type | Description |
| --- | --- | --- |
| center | <code>Object</code> | the center object with lat/lng |
| results | <code>Array.&lt;data&gt;</code> | all lat/lng within the square |
| distance | <code>Number</code> | distance in kilometers |

---
_Source: https://npm.io/package/geolocation-distances · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
