@turf/collect
Advanced tools
Comparing version 5.1.5 to 6.0.0
25
index.js
@@ -1,5 +0,6 @@ | ||
import turfbbox from '@turf/bbox'; | ||
import booleanPointInPolygon from '@turf/boolean-point-in-polygon'; | ||
import rbush from 'rbush'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var bbox_1 = require("@turf/bbox"); | ||
var boolean_point_in_polygon_1 = require("@turf/boolean-point-in-polygon"); | ||
var rbush_1 = require("rbush"); | ||
/** | ||
@@ -36,4 +37,3 @@ * Merges a specified property from a FeatureCollection of points into a | ||
function collect(polygons, points, inProperty, outProperty) { | ||
var rtree = rbush(6); | ||
var rtree = rbush_1.default(6); | ||
var treeItems = points.features.map(function (item) { | ||
@@ -48,24 +48,19 @@ return { | ||
}); | ||
rtree.load(treeItems); | ||
polygons.features.forEach(function (poly) { | ||
if (!poly.properties) { | ||
poly.properties = {}; | ||
} | ||
var bbox = turfbbox(poly); | ||
var potentialPoints = rtree.search({minX: bbox[0], minY: bbox[1], maxX: bbox[2], maxY: bbox[3]}); | ||
var bbox = bbox_1.default(poly); | ||
var potentialPoints = rtree.search({ minX: bbox[0], minY: bbox[1], maxX: bbox[2], maxY: bbox[3] }); | ||
var values = []; | ||
potentialPoints.forEach(function (pt) { | ||
if (booleanPointInPolygon([pt.minX, pt.minY], poly)) { | ||
if (boolean_point_in_polygon_1.default([pt.minX, pt.minY], poly)) { | ||
values.push(pt.property); | ||
} | ||
}); | ||
poly.properties[outProperty] = values; | ||
}); | ||
return polygons; | ||
} | ||
export default collect; | ||
exports.default = collect; |
{ | ||
"name": "@turf/collect", | ||
"version": "5.1.5", | ||
"version": "6.0.0", | ||
"description": "turf collect module", | ||
"main": "main.js", | ||
"module": "main.es.js", | ||
"types": "index.d.ts", | ||
"main": "index", | ||
"files": [ | ||
"index.js", | ||
"index.d.ts", | ||
"main.js", | ||
"main.es.js" | ||
"index.ts" | ||
], | ||
"scripts": { | ||
"pretest": "rollup -c ../../rollup.config.js", | ||
"test": "node -r @std/esm test.js", | ||
"posttest": "node -r @std/esm ../../scripts/validate-es5-dependencies.js", | ||
"bench": "node -r @std/esm bench.js", | ||
"prepare": "tsc", | ||
"pretest": "tsc", | ||
"test": "node test.js", | ||
"bench": "node bench.js", | ||
"docs": "node ../../scripts/generate-readmes" | ||
@@ -43,17 +39,12 @@ }, | ||
"devDependencies": { | ||
"@std/esm": "*", | ||
"benchmark": "*", | ||
"rollup": "*", | ||
"typescript": "*", | ||
"tape": "*" | ||
}, | ||
"dependencies": { | ||
"@turf/bbox": "^5.1.5", | ||
"@turf/boolean-point-in-polygon": "^5.1.5", | ||
"@turf/helpers": "^5.1.5", | ||
"rbush": "^2.0.1" | ||
}, | ||
"@std/esm": { | ||
"esm": "js", | ||
"cjs": true | ||
"@turf/bbox": "6.x", | ||
"@turf/boolean-point-in-polygon": "6.x", | ||
"@turf/helpers": "6.x", | ||
"rbush": "2.x" | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
3
10375
5
132
1
+ Added@turf/bbox@6.5.0(transitive)
+ Added@turf/boolean-point-in-polygon@6.5.0(transitive)
+ Added@turf/helpers@6.5.0(transitive)
+ Added@turf/invariant@6.5.0(transitive)
+ Added@turf/meta@6.5.0(transitive)
- Removed@turf/bbox@5.1.5(transitive)
- Removed@turf/boolean-point-in-polygon@5.1.5(transitive)
- Removed@turf/helpers@5.1.5(transitive)
- Removed@turf/invariant@5.2.0(transitive)
- Removed@turf/meta@5.2.0(transitive)
Updated@turf/bbox@6.x
Updated@turf/helpers@6.x
Updatedrbush@2.x