# cities

> Lookup cities based on zipcodes or GPS coordinates.

Latest version **2.0.0** (published 2018-10-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install cities
pnpm add cities
yarn add cities
bun add cities
```

## 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.0 |
| Published | 2018-10-29 |
| First published | 2013-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 3.9 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 28 |
| Author | Steven Lu |
| Maintainers | sjlu |

## Links

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

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [haversine](https://npm.io/package/haversine.md) ^1.0.0

## Recent versions

- 2.0.0 (latest) — 2018-10-29
- 1.1.2 — 2015-08-06
- 1.1.1 — 2015-06-25
- 1.1.0 — 2015-03-23
- 1.0.6 — 2013-03-07
- 1.0.5 — 2013-03-07
- 1.0.4 — 2013-03-06
- 1.0.3-1 — 2013-03-06
- 1.0.1 — 2013-03-06
- 1.0.0 — 2013-03-06

## README

# Cities

[![Circle CI](https://circleci.com/gh/sjlu/cities.svg?style=svg)](https://circleci.com/gh/sjlu/cities)

Cities is an easy to use Node.js library to allow you to lookup a city by it's zipcode or by a set
of GPS coordinates (reverse geocoding).

At the moment, this package only supports US cities only. There are plans to extend this in the
next version.

## Usage

### Webservice

Like any node.js application.

```
npm install
node server.js
```

You can then visit `http://localhost:4000` with the endpoints `/gps/:lat/:lng` or `/zip/:zipcode`
to get locations.

### Install

```
npm install cities --save
```

### Usage

```
var cities = require('cities');
```

#### Lookup by GPS coordinates

```
cities.gps_lookup(lat, lng);
```

#### Lookup by zipcode

```
cities.zip_lookup(zipcode);
```

#### Lookup by state

```
cities.findByState('NJ')
```

### Sample Response

A sample response or object that this module returns looks like this.

    {
        zipcode: "07946",
        state_abbr: "NJ",
        latitude: "40.672823",
        longitude: "-74.52011",
        city: "Millington",
        state: "New Jersey"
    }

## License

MIT.

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