# find-nearest-us-cities

> Searches the nearest cities in The United States using [geokdbush](https://github.com/mourner/geokdbush). Data courtesy [US at geonames.org](http://download.geonames.org/export/dump/). Based on [find-nearest-cities](https://github.com/steffenmllr/find-nea

Latest version **0.3.6** (published 2021-02-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install find-nearest-us-cities
pnpm add find-nearest-us-cities
yarn add find-nearest-us-cities
bun add find-nearest-us-cities
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.6 |
| Published | 2021-02-05 |
| First published | 2020-10-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | jmealo |

## Links

- npm: https://www.npmjs.com/package/find-nearest-us-cities
- Repository: https://github.com/jmealo/find-nearest-us-cities
- Homepage: https://github.com/jmealo/find-nearest-us-cities#readme
- Issues: https://github.com/jmealo/find-nearest-us-cities/issues
- npm.io page: https://npm.io/package/find-nearest-us-cities

## Dependencies (2)

- [kdbush](https://npm.io/package/kdbush.md) ^3.0.0
- [geokdbush](https://npm.io/package/geokdbush.md) ^1.1.0

## Recent versions

- 0.3.6 (latest) — 2021-02-05
- 0.3.5 — 2021-01-19
- 0.3.4 — 2021-01-18
- 0.3.3 — 2021-01-18
- 0.3.2 — 2021-01-18
- 0.3.1 — 2021-01-18
- 0.3.0 — 2020-10-27
- 0.2.0 — 2020-10-27
- 0.1.0 — 2020-10-27

## README

# find-nearest-us-cities

Searches the nearest cities in The United States using [geokdbush](https://github.com/mourner/geokdbush). Data courtesy [US at geonames.org](http://download.geonames.org/export/dump/). Based on [find-nearest-cities](https://github.com/steffenmllr/find-nearest-cities)

## Installing

```shell
npm install find-nearest-us-cities
```
## Usage

```js
const nearestCities = require('find-nearest-us-cities')

// The Rocky Statue
const latitude = 39.9649;
const longitude = -75.1802;

const cities = nearestCities(latitude, longitude);

/*
[ { 
    name: 'Fairmount',
    lat: 39.97233,
    lon: -75.18101,
    state: 'PA'
  },
  { name: 'Brewerytown',
    lat: 39.97706,
    lon: -75.18185,
    state: 'PA' },
  { name: 'Strawberry Mansion',
    lat: 39.98345,
    lon: -75.18268,
    state: 'PA' },
  { name: 'S.W. Ctr Cty',
    lat: 39.94281,
    lon: -75.18086,
    state: 'PA' },
  { name: 'Point Breeze',
    lat: 39.93345,
    lon: -75.17796,
    state: 'PA' }
]
*/
```

## API

#### nearestCities(longitude, latitude[, maxDistance, maxResults])

Returns an array of the closest points from a given location in order of increasing distance.

- `longitude`: query point longitude.
- `latitude`: query point latitude.
- `maxDistance`: (optional) maximum distance in meters to search within (`Infinity` by default).
- `maxResults`: (optional) maximum number of points to return (`5` by default).

## Data License

[The Dataset](http://download.geonames.org/export/dump/) is published under [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/) by *geonames.org*.

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