UNPKG

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