# bbox2extent

> Transform a GeoJSON bounding box into an Esri-formatted extent object.

Latest version **1.1.1** (published 2015-08-03) · ISC license · 0 weekly downloads

## Install

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

## 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 | 1.1.1 |
| Published | 2015-08-03 |
| First published | 2015-03-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Nate Goldman |
| Maintainers | ngoldman, chelm, dmfenton |
| Keywords | arcgis, bbox, esri, extent, geojson, gis |

## Links

- npm: https://www.npmjs.com/package/bbox2extent
- Repository: https://github.com/koopjs/bbox2extent
- Issues: https://github.com/koopjs/bbox2extent/issues
- npm.io page: https://npm.io/package/bbox2extent

## 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

- 1.1.1 (latest) — 2015-08-03
- 1.1.0 — 2015-03-27
- 1.0.1 — 2015-03-19
- 1.0.0 — 2015-03-19

## README

# bbox2extent

> Transform a GeoJSON bounding box into an Esri-formatted extent object.

[![](https://img.shields.io/npm/v/bbox2extent.svg?style=flat-square)](https://www.npmjs.com/package/bbox2extent)
[![](https://img.shields.io/travis/koopjs/bbox2extent.svg?style=flat-square)](https://travis-ci.org/koopjs/bbox2extent)

## Install

```
npm install bbox2extent
```

## Usage

```js
var bbox2extent = require('bbox2exent')
var bbox = [100, 0, 105, 1]

var extent = bbox2extent(bbox)
// {
//   xmin: 100,
//   ymin: 0,
//   xmax: 105,
//   ymax: 1,
//   spatialReference: {
//     wkid: 4326,
//     latestWkid: 4326
//   }
// }

// -- OR --

bbox2extent(bbox, function (err, extent) {
  if (err) throw err

  console.log(extent)
  // {
  //   xmin: 100,
  //   ymin: 0,
  //   xmax: 105,
  //   ymax: 1,
  //   spatialReference: {
  //     wkid: 4326,
  //     latestWkid: 4326
  //   }
  // }
})
```

Also supports reverse operation (converting an extent to a bounding box) via `reverse`:

```js
var extent2bbox = require('bbox2extent').reverse
var extent = {
  xmin: -108.9395,
  ymin: 37.084968,
  xmax: -102,
  ymax: 40.8877,
  spatialReference: {
    wkid: 4326,
    latestWkid: 4326
  }
}

var bbox = extent2bbox(extent)
// [ -108.9395, 37.084968, -102, 40.8877 ]

// -- OR --

extent2bbox(extent, function (err, bbox) {
  if (err) throw err

  console.log(bbox)
  // [ -108.9395, 37.084968, -102, 40.8877 ]
})
```

## Contributing

`bbox2extent` is an **OPEN Open Source Project**. This means that:

> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.

See the [CONTRIBUTING.md](CONTRIBUTING.md) file for more details.

## License

[ISC](LICENSE)

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