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