Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turf/bbox

Package Overview
Dependencies
Maintainers
4
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/bbox - npm Package Compare versions

Comparing version 4.1.0 to 4.2.0

30

index.js

@@ -1,2 +0,2 @@

var each = require('@turf/meta').coordEach;
var coordEach = require('@turf/meta').coordEach;

@@ -7,24 +7,22 @@ /**

* @name bbox
* @param {(Feature|FeatureCollection)} geojson input features
* @param {FeatureCollection|Feature<any>} geojson input features
* @returns {Array<number>} bbox extent in [minX, minY, maxX, maxY] order
* @addToMap features, bboxPolygon
* @example
* var pt1 = turf.point([114.175329, 22.2524])
* var pt2 = turf.point([114.170007, 22.267969])
* var pt3 = turf.point([114.200649, 22.274641])
* var pt4 = turf.point([114.200649, 22.274641])
* var pt5 = turf.point([114.186744, 22.265745])
* var features = turf.featureCollection([pt1, pt2, pt3, pt4, pt5])
* var line = {
* "type": "Feature",
* "properties": {},
* "geometry": {
* "type": "LineString",
* "coordinates": [[-74, 40], [-78, 42], [-82, 35]]
* }
* }
* var bbox = turf.bbox(line);
*
* var bbox = turf.bbox(features);
*
* //addToMap
* var bboxPolygon = turf.bboxPolygon(bbox);
*
* //=bbox
*
* //=bboxPolygon
* var addToMap = [line, bboxPolygon]
*/
module.exports = function (geojson) {
var bbox = [Infinity, Infinity, -Infinity, -Infinity];
each(geojson, function (coord) {
coordEach(geojson, function (coord) {
if (bbox[0] > coord[0]) bbox[0] = coord[0];

@@ -31,0 +29,0 @@ if (bbox[1] > coord[1]) bbox[1] = coord[1];

{
"name": "@turf/bbox",
"version": "4.1.0",
"version": "4.2.0",
"description": "turf bbox module",

@@ -38,4 +38,4 @@ "main": "index.js",

"dependencies": {
"@turf/meta": "^4.1.0"
"@turf/meta": "^4.2.0"
}
}

@@ -9,3 +9,3 @@ # @turf/bbox

- `geojson` **([Feature](http://geojson.org/geojson-spec.html#feature-objects) \| [FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects))** input features
- `geojson` **([FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)&lt;any>)** input features

@@ -15,16 +15,15 @@ **Examples**

```javascript
var pt1 = turf.point([114.175329, 22.2524])
var pt2 = turf.point([114.170007, 22.267969])
var pt3 = turf.point([114.200649, 22.274641])
var pt4 = turf.point([114.200649, 22.274641])
var pt5 = turf.point([114.186744, 22.265745])
var features = turf.featureCollection([pt1, pt2, pt3, pt4, pt5])
var line = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [[-74, 40], [-78, 42], [-82, 35]]
}
}
var bbox = turf.bbox(line);
var bbox = turf.bbox(features);
//addToMap
var bboxPolygon = turf.bboxPolygon(bbox);
//=bbox
//=bboxPolygon
var addToMap = [line, bboxPolygon]
```

@@ -31,0 +30,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc