geojson-bounding-box
Version:
Efficiently computes a GeoJSON's bounding box.
53 lines (37 loc) • 1.41 kB
Markdown
# geojson-bounding-box
[](https://travis-ci.org/dpmcmlxxvi/geojson-bounding-box)
[](https://coveralls.io/r/dpmcmlxxvi/geojson-bounding-box?branch=master)
[](https://badge.fury.io/js/geojson-bounding-box)
[](https://www.codacy.com/app/dpmcmlxxvi/geojson-bounding-box?utm_source=github.com&utm_medium=referral&utm_content=dpmcmlxxvi/geojson-bounding-box&utm_campaign=Badge_Grade)
Efficiently computes a GeoJSON's bounding box using a generator to traverse its
coordinates.
## GETTING STARTED
### Install
```bash
npm install --save geojson-bounding-box
```
### Example
```javascript
const toBBox = require('geojson-bounding-box');
const line = {
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[0, 1], [1, 2], [2, 1]
]
},
"properties": {}
};
const bbox = toBBox(line);
// = [0, 1, 2, 2]
```
## BUILD
To build and test the library locally:
```shell
npm install
npm test
```
## LICENSE
Copyright (c) 2019 Daniel Pulido <mailto:dpmcmlxxvi@gmail.com>
Source code is released under the [MIT License](http://opensource.org/licenses/ISC).