turf-envelope
Advanced tools
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; | ||
} | ||
} |
{ | ||
"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 | ||
``` | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6393
120
51
4
+ Addedturf-bbox-polygon@1.0.2(transitive)
+ Addedturf-extent@1.0.4(transitive)
+ Addedturf-meta@1.0.2(transitive)
+ Addedturf-polygon@1.0.3(transitive)
- Removedflatten@0.0.1(transitive)
- Removedturf-bbox-polygon@0.1.5(transitive)
- Removedturf-extent@0.1.4(transitive)
- Removedturf-polygon@0.1.1(transitive)
Updatedturf-bbox-polygon@^1.0.0
Updatedturf-extent@^1.0.3