UNPKG

1.31 kBMarkdownView Raw
1# @turf/bbox
2
3<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
4
5## bbox
6
7Takes 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
16var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]]);
17var bbox = turf.bbox(line);
18var bboxPolygon = turf.bboxPolygon(bbox);
19
20//addToMap
21var addToMap = [line, bboxPolygon]
22```
23
24Returns **[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<!-- This file is automatically generated. Please don't edit it directly:
31if 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
36This module is part of the [Turfjs project](http://turfjs.org/), an open source
37module collection dedicated to geographic algorithms. It is maintained in the
38[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
39PRs and issues.
40
41### Installation
42
43Install this module individually:
44
45```sh
46$ npm install @turf/bbox
47```
48
49Or install the Turf module that includes it as a function:
50
51```sh
52$ npm install @turf/turf
53```