# lonlat

> Converters for various coordinate representations.

Latest version **2.0.2** (published 2025-05-22) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

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

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2025-05-22 |
| First published | 2015-05-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Damian Krzeminski |
| Maintainers | pirxpilot |
| Keywords | lonlat, latitude, longitude, GeoJSON |

## Links

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

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.0.2 (latest) — 2025-05-22
- 2.0.1 — 2024-12-28
- 2.0.0 — 2024-03-14
- 1.0.2 — 2017-02-20
- 1.0.1 — 2016-09-13
- 1.0.0 — 2016-09-13
- 0.4.0 — 2015-11-18
- 0.3.0 — 2015-05-26
- 0.2.0 — 2015-05-26
- 0.1.0 — 2015-05-22
- 0.0.0 — 2015-05-21

## README

[![NPM version][npm-image]][npm-url]
[![Build Status][build-image]][build-url]
[![Dependency Status][deps-image]][deps-url]

# lonlat

Converters for various coordinate representations.

## Install

```sh
$ npm install --save lonlat
```

## Usage

```js
var lonlat = require('lonlat');

lonlat.geojson.centerSphere();
lonlat.mongo.toPoly();
```

### `geojson` methods always return geojson shape or collection of shapes

- `centerSphere`- create a Sphere corresponding to inscribed circle
- `multiPolygon` - create a Polygon from the string of coordinates
- `polygon` - create a Polygon from the string of coordinates
- `shapesArray` - split boxes into Polygons and Multipolygons
- `splitBox` - split box into grid of Polygons


### `mongo` methods return coordinates pairs [lon,lat] that can be indexed by mongo

- `toLonLat`
- `toPoly`
- `toBox`
- `toBoxes`

## License

MIT © [Damian Krzeminski](https://pirxpilot.me)

[npm-image]: https://img.shields.io/npm/v/lonlat
[npm-url]: https://npmjs.org/package/lonlat

[build-url]: https://github.com/pirxpilot/lonlat/actions/workflows/check.yaml
[build-image]: https://img.shields.io/github/actions/workflow/status/pirxpilot/lonlat/check.yaml?branch=main

[deps-image]: https://img.shields.io/librariesio/release/npm/lonlat
[deps-url]: https://libraries.io/npm/lonlat

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