@turf/collect
Advanced tools
Comparing version 3.5.1 to 3.5.2-alpha.d2c36ee7
22
index.js
@@ -17,14 +17,14 @@ var inside = require('@turf/inside'); | ||
* @example | ||
* var poly1 = polygon([[[0,0],[10,0],[10,10],[0,10],[0,0]]]); | ||
* var poly2 = polygon([[[10,0],[20,10],[20,20],[20,0],[10,0]]]); | ||
* var polyFC = featurecollection([poly1, poly2]); | ||
* var pt1 = point([5,5], {population: 200}); | ||
* var pt2 = point([1,3], {population: 600}); | ||
* var pt3 = point([14,2], {population: 100}); | ||
* var pt4 = point([13,1], {population: 200}); | ||
* var pt5 = point([19,7], {population: 300}); | ||
* var ptFC = featurecollection([pt1, pt2, pt3, pt4, pt5]); | ||
* var aggregated = aggregate(polyFC, ptFC, 'population', 'values'); | ||
* var poly1 = turf.polygon([[[0,0],[10,0],[10,10],[0,10],[0,0]]]); | ||
* var poly2 = turf.polygon([[[10,0],[20,10],[20,20],[20,0],[10,0]]]); | ||
* var polyFC = turf.featureCollection([poly1, poly2]); | ||
* var pt1 = turf.point([5,5], {population: 200}); | ||
* var pt2 = turf.point([1,3], {population: 600}); | ||
* var pt3 = turf.point([14,2], {population: 100}); | ||
* var pt4 = turf.point([13,1], {population: 200}); | ||
* var pt5 = turf.point([19,7], {population: 300}); | ||
* var ptFC = turf.featureCollection([pt1, pt2, pt3, pt4, pt5]); | ||
* var collected = turf.collect(polyFC, ptFC, 'population', 'values'); | ||
* | ||
* aggregated.features[0].properties.values // => [200, 600]); | ||
* collected.features[0].properties.values // => [200, 600]); | ||
*/ | ||
@@ -31,0 +31,0 @@ module.exports = function collect(polygons, points, inProperty, outProperty) { |
{ | ||
"name": "@turf/collect", | ||
"version": "3.5.1", | ||
"version": "3.5.2-alpha.d2c36ee7", | ||
"description": "turf aggregate module", | ||
@@ -30,7 +30,7 @@ "main": "index.js", | ||
"tape": "^3.5.0", | ||
"@turf/helpers": "^3.3.3" | ||
"@turf/helpers": "^3.5.2-alpha.d2c36ee7" | ||
}, | ||
"dependencies": { | ||
"@turf/inside": "^3.3.3" | ||
"@turf/inside": "^3.5.2-alpha.d2c36ee7" | ||
} | ||
} |
@@ -5,7 +5,7 @@ # @turf/collect | ||
Joins attributes FeatureCollection of polygons with a FeatureCollection of | ||
points. Given an `inProperty` on points and an `outProperty` for polygons, | ||
this finds every point that lies within each polygon, collects the `inProperty` | ||
values from those points, and adds them as an array to `outProperty` on the | ||
polygon. | ||
Merges a specified property from a FeatureCollection of points into a | ||
FeatureCollection of polygons. Given an `inProperty` on points and an `outProperty` | ||
for polygons, this finds every point that lies within each polygon, collects the | ||
`inProperty` values from those points, and adds them as an array to `outProperty` | ||
on the polygon. | ||
@@ -22,14 +22,14 @@ **Parameters** | ||
```javascript | ||
var poly1 = polygon([[[0,0],[10,0],[10,10],[0,10],[0,0]]]); | ||
var poly2 = polygon([[[10,0],[20,10],[20,20],[20,0],[10,0]]]); | ||
var polyFC = featurecollection([poly1, poly2]); | ||
var pt1 = point([5,5], {population: 200}); | ||
var pt2 = point([1,3], {population: 600}); | ||
var pt3 = point([14,2], {population: 100}); | ||
var pt4 = point([13,1], {population: 200}); | ||
var pt5 = point([19,7], {population: 300}); | ||
var ptFC = featurecollection([pt1, pt2, pt3, pt4, pt5]); | ||
var aggregated = aggregate(polyFC, ptFC, 'population', 'values'); | ||
var poly1 = turf.polygon([[[0,0],[10,0],[10,10],[0,10],[0,0]]]); | ||
var poly2 = turf.polygon([[[10,0],[20,10],[20,20],[20,0],[10,0]]]); | ||
var polyFC = turf.featureCollection([poly1, poly2]); | ||
var pt1 = turf.point([5,5], {population: 200}); | ||
var pt2 = turf.point([1,3], {population: 600}); | ||
var pt3 = turf.point([14,2], {population: 100}); | ||
var pt4 = turf.point([13,1], {population: 200}); | ||
var pt5 = turf.point([19,7], {population: 300}); | ||
var ptFC = turf.featureCollection([pt1, pt2, pt3, pt4, pt5]); | ||
var collected = turf.collect(polyFC, ptFC, 'population', 'values'); | ||
aggregated.features[0].properties.values // => [200, 600]); | ||
collected.features[0].properties.values // => [200, 600]); | ||
``` | ||
@@ -39,2 +39,6 @@ | ||
<!-- This file is automatically generated. Please don't edit it directly: | ||
if you find an error, edit the source file (likely index.js), and re-run | ||
./scripts/generate-readmes in the turf project. --> | ||
--- | ||
@@ -41,0 +45,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
61
8997
7
1
1