@turf/collect
Advanced tools
Comparing version 4.7.3 to 5.0.4
@@ -1,11 +0,11 @@ | ||
/// <reference types="geojson" /> | ||
import { FeatureCollection, Polygon, Feature, Point } from '@turf/helpers'; | ||
type Polygons = GeoJSON.FeatureCollection<GeoJSON.Polygon>; | ||
type Points = GeoJSON.FeatureCollection<GeoJSON.Point>; | ||
/** | ||
* http://turfjs.org/docs/#collect | ||
*/ | ||
declare function collect(polygons: Polygons, points: Points, inProperty: string, outProperty: string): Polygons; | ||
declare namespace collect { } | ||
export = collect; | ||
export default function ( | ||
polygons: FeatureCollection<Polygon>, | ||
points: FeatureCollection<Point>, | ||
inProperty: string, | ||
outProperty: string | ||
): FeatureCollection<Polygon>; |
12
index.js
@@ -1,3 +0,3 @@ | ||
var turfbbox = require('@turf/bbox'); | ||
var inside = require('@turf/inside'); | ||
import turfbbox from '@turf/bbox'; | ||
import booleanPointInPolygon from '@turf/boolean-point-in-polygon'; | ||
var rbush = require('rbush'); | ||
@@ -35,3 +35,3 @@ | ||
*/ | ||
module.exports = function (polygons, points, inProperty, outProperty) { | ||
function collect(polygons, points, inProperty, outProperty) { | ||
var rtree = rbush(6); | ||
@@ -59,3 +59,3 @@ | ||
potentialPoints.forEach(function (pt) { | ||
if (inside({'type': 'Point', 'coordinates': [pt.minX, pt.minY]}, poly)) { | ||
if (booleanPointInPolygon([pt.minX, pt.minY], poly)) { | ||
values.push(pt.property); | ||
@@ -69,2 +69,4 @@ } | ||
return polygons; | ||
}; | ||
} | ||
export default collect; |
{ | ||
"name": "@turf/collect", | ||
"version": "4.7.3", | ||
"version": "5.0.4", | ||
"description": "turf collect module", | ||
"main": "index.js", | ||
"main": "main", | ||
"module": "index", | ||
"jsnext:main": "index", | ||
"types": "index.d.ts", | ||
"files": [ | ||
"index.js", | ||
"index.d.ts" | ||
"index.d.ts", | ||
"main.js" | ||
], | ||
"scripts": { | ||
"test": "node test.js", | ||
"bench": "node bench.js" | ||
"pretest": "rollup -c ../../rollup.config.js", | ||
"test": "node -r @std/esm test.js", | ||
"bench": "node -r @std/esm bench.js" | ||
}, | ||
@@ -19,5 +23,2 @@ "repository": { | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/Turfjs/turf/issues" | ||
}, | ||
"keywords": [ | ||
@@ -31,3 +32,2 @@ "aggregate", | ||
], | ||
"homepage": "https://github.com/Turfjs/turf", | ||
"author": "Turf Authors", | ||
@@ -38,12 +38,22 @@ "contributors": [ | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/Turfjs/turf/issues" | ||
}, | ||
"homepage": "https://github.com/Turfjs/turf", | ||
"devDependencies": { | ||
"@turf/helpers": "^4.7.3", | ||
"benchmark": "^2.1.4", | ||
"tape": "^4.6.3" | ||
"@std/esm": "*", | ||
"benchmark": "*", | ||
"rollup": "*", | ||
"tape": "*" | ||
}, | ||
"dependencies": { | ||
"@turf/bbox": "^4.7.3", | ||
"@turf/inside": "^4.7.3", | ||
"@turf/bbox": "^5.0.4", | ||
"@turf/boolean-point-in-polygon": "^5.0.4", | ||
"@turf/helpers": "^5.0.4", | ||
"rbush": "^2.0.1" | ||
}, | ||
"@std/esm": { | ||
"esm": "js", | ||
"cjs": true | ||
} | ||
} |
# @turf/collect | ||
# collect | ||
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
## collect | ||
Merges a specified property from a FeatureCollection of points into a | ||
@@ -6,0 +8,0 @@ FeatureCollection of polygons. Given an `inProperty` on points and an `outProperty` |
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
10766
6
137
66
4
4
+ Added@turf/helpers@^5.0.4
+ Added@turf/bbox@5.1.5(transitive)
+ Added@turf/boolean-point-in-polygon@5.1.5(transitive)
+ Added@turf/helpers@5.1.5(transitive)
+ Added@turf/invariant@5.2.0(transitive)
+ Added@turf/meta@5.2.0(transitive)
- Removed@turf/inside@^4.7.3
- Removed@turf/bbox@4.7.3(transitive)
- Removed@turf/inside@4.7.3(transitive)
- Removed@turf/invariant@4.7.3(transitive)
- Removed@turf/meta@4.7.4(transitive)
Updated@turf/bbox@^5.0.4