turf-envelope
Advanced tools
+54
-1
| 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; | ||
| } | ||
| } |
+11
-8
| { | ||
| "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" | ||
| } | ||
| } |
+36
-26
@@ -1,40 +0,50 @@ | ||
| turf-envelope | ||
| ============= | ||
| [](https://travis-ci.org/Turfjs/turf-envelope) | ||
| # turf-envelope | ||
| Takes a Feature or FeatureCollection and returns a rectangular polygon feature that encompasses all vertices. | ||
| [](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 | ||
| ``` | ||
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
6393
30.98%120
79.1%51
27.5%4
100%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
Updated
Updated