Socket
Socket
Sign inDemoInstall

turf-envelope

Package Overview
Dependencies
Maintainers
9
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turf-envelope - npm Package Compare versions

Comparing version 1.0.2 to 3.0.0-canary.2f5f7167

4

bench.js

@@ -5,3 +5,3 @@ var envelope = require('./');

var fixture = require('./geojson/fc.js');
var fixture = require('./test/fc.js');
var suite = new Benchmark.Suite('turf-envelope');

@@ -18,2 +18,2 @@ suite

})
.run();
.run();

@@ -1,11 +0,11 @@

var extent = require('turf-extent');
var bbox = require('turf-bbox');
var bboxPolygon = require('turf-bbox-polygon');
/**
* Takes a {@link Feature} or {@link FeatureCollection} and returns a rectangular {@link Polygon} feature that encompasses all vertices.
* Takes any number of features and returns a rectangular {@link Polygon} that encompasses all vertices.
*
* @module turf/envelope
* @name envelope
* @category measurement
* @param {FeatureCollection} fc a FeatureCollection of any type
* @return {Polygon} a rectangular Polygon feature that encompasses all vertices
* @param {FeatureCollection} fc input features
* @return {Feature<Polygon>} a rectangular Polygon feature that encompasses all vertices
* @example

@@ -57,6 +57,4 @@ * var fc = {

module.exports = function(features, done){
var bbox = extent(features);
var poly = bboxPolygon(bbox);
return poly;
}
module.exports = function (features) {
return bboxPolygon(bbox(features));
};
{
"name": "turf-envelope",
"version": "1.0.2",
"version": "3.0.0-canary.2f5f7167",
"description": "turf envelope module",
"main": "index.js",
"scripts": {
"test": "node test.js",
"doc": "dox -r < index.js | doxme --readme > README.md"
"test": "node test.js"
},

@@ -29,10 +28,8 @@ "repository": {

"benchmark": "^1.0.0",
"tape": "^3.5.0",
"dox": "^0.6.1",
"doxme": "^1.4.3"
"tape": "^3.5.0"
},
"dependencies": {
"turf-bbox-polygon": "^1.0.0",
"turf-extent": "^1.0.3"
"turf-bbox-polygon": "^3.0.0-canary.2f5f7167",
"turf-bbox": "^3.0.0-canary.2f5f7167"
}
}

@@ -10,3 +10,3 @@ # turf-envelope

Takes a Feature or FeatureCollection and returns a rectangular Polygon feature that encompasses all vertices.
Takes any number of features and returns a rectangular Polygon that encompasses all vertices.

@@ -16,5 +16,5 @@

| parameter | type | description |
| --------- | ----------------- | ------------------------------- |
| `fc` | FeatureCollection | a FeatureCollection of any type |
| parameter | type | description |
| --------- | ----------------- | -------------- |
| `fc` | FeatureCollection | input features |

@@ -25,12 +25,43 @@

```js
var fc = turf.featurecollection([
turf.point([-75.343, 39.984], {name: 'Location A'}),
turf.point([-75.833, 39.284], {name: 'Location B'}),
turf.point([-75.534, 39.123], {name: 'Location C'})
]);
var fc = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "Location A"
},
"geometry": {
"type": "Point",
"coordinates": [-75.343, 39.984]
}
}, {
"type": "Feature",
"properties": {
"name": "Location B"
},
"geometry": {
"type": "Point",
"coordinates": [-75.833, 39.284]
}
}, {
"type": "Feature",
"properties": {
"name": "Location C"
},
"geometry": {
"type": "Point",
"coordinates": [-75.534, 39.123]
}
}
]
};
var enveloped = turf.envelope(fc);
var result = turf.featurecollection(
fc.features.concat(enveloped));
var resultFeatures = fc.features.concat(enveloped);
var result = {
"type": "FeatureCollection",
"features": resultFeatures
};

@@ -40,2 +71,5 @@ //=result

**Returns** `Feature.<Polygon>`, a rectangular Polygon feature that encompasses all vertices
## Installation

@@ -55,1 +89,2 @@

var test = require('tape');
var envelope = require('./');
var fc = require('./geojson/fc.js');
var fc = require('./test/geojson/fc.json');

@@ -9,3 +9,6 @@ test('envelope', function(t){

t.equal(enveloped.geometry.type, 'Polygon');
t.deepEqual(enveloped.geometry.coordinates,
[ [ [ 20, -10 ], [ 130, -10 ], [ 130, 4 ], [ 20, 4 ], [ 20, -10 ] ] ] ,
'positions are correct');
t.end();
})
})

Sorry, the diff of this file is not supported yet

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