Socket
Socket
Sign inDemoInstall

turf-envelope

Package Overview
Dependencies
Maintainers
8
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.1 to 1.0.2

55

index.js
var extent = require('turf-extent');
var bboxPolygon = require('turf-bbox-polygon');
/**
* Takes a {@link Feature} or {@link FeatureCollection} and returns a rectangular {@link Polygon} feature that encompasses all vertices.
*
* @module turf/envelope
* @category measurement
* @param {FeatureCollection} fc a FeatureCollection of any type
* @return {Polygon} a rectangular Polygon feature that encompasses all vertices
* @example
* 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 resultFeatures = fc.features.concat(enveloped);
* var result = {
* "type": "FeatureCollection",
* "features": resultFeatures
* };
*
* //=result
*/
module.exports = function(features, done){

@@ -8,2 +61,2 @@ var bbox = extent(features);

return poly;
}
}

19

package.json
{
"name": "turf-envelope",
"version": "1.0.1",
"version": "1.0.2",
"description": "turf envelope module",
"main": "index.js",
"scripts": {
"test": "node test.js"
"test": "node test.js",
"doc": "dox -r < index.js | doxme --readme > README.md"
},
"repository": {
"type": "git",
"url": "https://github.com/morganherlocker/turf-envelope.git"
"url": "https://github.com/Turfjs/turf-envelope.git"
},

@@ -23,13 +24,15 @@ "keywords": [

"bugs": {
"url": "https://github.com/morganherlocker/turf-envelope/issues"
"url": "https://github.com/Turfjs/turf-envelope/issues"
},
"homepage": "https://github.com/morganherlocker/turf-envelope",
"homepage": "https://github.com/Turfjs/turf-envelope",
"devDependencies": {
"benchmark": "^1.0.0",
"tape": "^3.0.3"
"tape": "^3.5.0",
"dox": "^0.6.1",
"doxme": "^1.4.3"
},
"dependencies": {
"turf-bbox-polygon": "^0.1.5",
"turf-extent": "^0.1.4"
"turf-bbox-polygon": "^1.0.0",
"turf-extent": "^1.0.3"
}
}

@@ -1,40 +0,50 @@

turf-envelope
=============
[![Build Status](https://travis-ci.org/Turfjs/turf-envelope.svg?branch=master)](https://travis-ci.org/Turfjs/turf-envelope)
# turf-envelope
Takes a Feature or FeatureCollection and returns a rectangular polygon feature that encompasses all vertices.
[![build status](https://secure.travis-ci.org/Turfjs/turf-envelope.png)](http://travis-ci.org/Turfjs/turf-envelope)
###Install
turf envelope module
```sh
npm install turf-envelope
```
###Parameters
### `turf.envelope(fc)`
|name|description|
|---|---|
|fc|A FeatureCollection|
Takes a Feature or FeatureCollection and returns a rectangular Polygon feature that encompasses all vertices.
###Usage
### Parameters
| parameter | type | description |
| --------- | ----------------- | ------------------------------- |
| `fc` | FeatureCollection | a FeatureCollection of any type |
### Example
```js
envelope(fc)
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 enveloped = turf.envelope(fc);
var result = turf.featurecollection(
fc.features.concat(enveloped));
//=result
```
###Example
## Installation
```javascript
var envelope = require('turf-envelope')
var point = require('turf-point')
var featurecollection = require('turf-featurecollection')
Requires [nodejs](http://nodejs.org/).
var pt1 = point(-75.343, 39.984, {name: 'Location A'})
var pt2 = point(-75.833, 39.284, {name: 'Location B'})
var pt3 = point(-75.534, 39.123, {name: 'Location C'})
var fc = featurecollection([pt1, pt2, pt3])
```sh
$ npm install turf-envelope
```
var enveloped = envelope(fc)
## Tests
console.log(envelopePoly)
```
```sh
$ npm test
```
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