1 | # @turf/bbox
|
2 |
|
3 | # bbox
|
4 |
|
5 | Takes a set of features, calculates the bbox of all input features, and returns a bounding box.
|
6 |
|
7 | **Parameters**
|
8 |
|
9 | - `geojson` **([FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)<any>)** input features
|
10 |
|
11 | **Examples**
|
12 |
|
13 | ```javascript
|
14 | var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]]);
|
15 | var bbox = turf.bbox(line);
|
16 | var bboxPolygon = turf.bboxPolygon(bbox);
|
17 |
|
18 | //addToMap
|
19 | var addToMap = [line, bboxPolygon]
|
20 | ```
|
21 |
|
22 | Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** bbox extent in [minX, minY, maxX, maxY] order
|
23 |
|
24 |
|
25 | if you find an error, edit the source file (likely index.js), and re-run
|
26 | ./scripts/generate-readmes in the turf project. -->
|
27 |
|
28 | ---
|
29 |
|
30 | This module is part of the [Turfjs project](http://turfjs.org/), an open source
|
31 | module collection dedicated to geographic algorithms. It is maintained in the
|
32 | [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
|
33 | PRs and issues.
|
34 |
|
35 | ### Installation
|
36 |
|
37 | Install this module individually:
|
38 |
|
39 | ```sh
|
40 | $ npm install @turf/bbox
|
41 | ```
|
42 |
|
43 | Or install the Turf module that includes it as a function:
|
44 |
|
45 | ```sh
|
46 | $ npm install @turf/turf
|
47 | ```
|