# geojson-extent

> compute the bounding box of geojson features

Latest version **0.3.2** (published 2016-02-09) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install geojson-extent
pnpm add geojson-extent
yarn add geojson-extent
bun add geojson-extent
```

Provides the command `geojson-extent`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.3.2 |
| Published | 2016-02-09 |
| First published | 2014-04-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 73 |
| Author | Tom MacWright |
| Maintainers | tmcw |
| Keywords | geojson, extent, browser, geo, boundingbox, bounds |

## Links

- npm: https://www.npmjs.com/package/geojson-extent
- Repository: https://github.com/mapbox/geojson-extent
- Issues: https://github.com/mapbox/geojson-extent/issues
- npm.io page: https://npm.io/package/geojson-extent

## Dependencies (4)

- [rw](https://npm.io/package/rw.md) ~0.1.4
- [extent](https://npm.io/package/extent.md) 0.2.0
- [traverse](https://npm.io/package/traverse.md) ~0.6.6
- [geojson-coords](https://npm.io/package/geojson-coords.md) 0.0.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.3.2 (latest) — 2016-02-09
- 0.3.1 — 2014-08-11
- 0.3.0 — 2014-08-01
- 0.2.0 — 2014-07-22
- 0.1.0 — 2014-07-16
- 0.0.1 — 2014-05-09
- 0.0.0 — 2014-04-21

## README

![](http://img.shields.io/travis/mapbox/geojson-extent.svg?style=flat)

# geojson-extent

Compute an extent given a GeoJSON object.

## install

    npm install --save geojson-extent

## example

[Live example with Mapbox Static Map API](https://www.mapbox.com/mapbox.js/example/v1.0.0/static-map-from-geojson-with-geo-viewport/)

```js
var geojsonExtent = require('geojson-extent');

geojsonExtent({ type: 'Point', coordinates: [0, 0] }); // returns 0,0,0,0 extent
```

## bin

Provides a binary that takes GeoJSON as stdin and returns a JSON stringified
array of extent data.

```sh
$ npm install -g geojson-extent
$ geojson-extent < file.geojson
```

Given an argument of `leaflet`, this will return Leaflet-formatted data instead.

```sh
$ geojson-extent leaflet < file.geojson
```

## api

### `extent(geojson)`

Given any valid GeoJSON object, return bounds in the form `[WSEN]`.
Invalid objects will return `null`.

### `extent.polygon(geojson)`

Given any valid GeoJSON object, return bounds in the form of a GeoJSON polygon object.
Invalid objects will return `null`.

### `extent.bboxify(geojson)`

Add [bounding boxes](http://geojson.org/geojson-spec.html#bounding-boxes) to all
appropriate GeoJSON objects - Feature, FeatureCollection, and Geometry.

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