@turf/points-within-polygon
Advanced tools
Comparing version 6.2.0-alpha.2 to 6.2.0-alpha.3
@@ -41,15 +41,15 @@ import pointInPolygon from '@turf/boolean-point-in-polygon'; | ||
function pointsWithinPolygon(points, polygons) { | ||
var results = []; | ||
featureEach(points, function (point) { | ||
var contained = false; | ||
geomEach(polygons, function (polygon) { | ||
if (pointInPolygon(point, polygon)) contained = true; | ||
}); | ||
if (contained) { | ||
results.push(point); | ||
} | ||
var results = []; | ||
featureEach(points, function (point) { | ||
var contained = false; | ||
geomEach(polygons, function (polygon) { | ||
if (pointInPolygon(point, polygon)) contained = true; | ||
}); | ||
return featureCollection(results); | ||
if (contained) { | ||
results.push(point); | ||
} | ||
}); | ||
return featureCollection(results); | ||
} | ||
export default pointsWithinPolygon; |
@@ -45,16 +45,15 @@ 'use strict'; | ||
function pointsWithinPolygon(points, polygons) { | ||
var results = []; | ||
meta.featureEach(points, function (point) { | ||
var contained = false; | ||
meta.geomEach(polygons, function (polygon) { | ||
if (pointInPolygon(point, polygon)) contained = true; | ||
}); | ||
if (contained) { | ||
results.push(point); | ||
} | ||
var results = []; | ||
meta.featureEach(points, function (point) { | ||
var contained = false; | ||
meta.geomEach(polygons, function (polygon) { | ||
if (pointInPolygon(point, polygon)) contained = true; | ||
}); | ||
return helpers.featureCollection(results); | ||
if (contained) { | ||
results.push(point); | ||
} | ||
}); | ||
return helpers.featureCollection(results); | ||
} | ||
module.exports = pointsWithinPolygon; | ||
module.exports.default = pointsWithinPolygon; |
@@ -1,2 +0,9 @@ | ||
import { Feature, FeatureCollection, Polygon, MultiPolygon, Point, Properties } from '@turf/helpers' | ||
import { | ||
Feature, | ||
FeatureCollection, | ||
Polygon, | ||
MultiPolygon, | ||
Point, | ||
Properties, | ||
} from "@turf/helpers"; | ||
@@ -6,5 +13,8 @@ /** | ||
*/ | ||
export default function pointsWithinPolygon<G extends Polygon | MultiPolygon, P = Properties>( | ||
points: Feature<Point, P> | FeatureCollection<Point, P>, | ||
polygons: Feature<G> | FeatureCollection<G> | G | ||
export default function pointsWithinPolygon< | ||
G extends Polygon | MultiPolygon, | ||
P = Properties | ||
>( | ||
points: Feature<Point, P> | FeatureCollection<Point, P>, | ||
polygons: Feature<G> | FeatureCollection<G> | G | ||
): FeatureCollection<Point, P>; |
{ | ||
"name": "@turf/points-within-polygon", | ||
"version": "6.2.0-alpha.2", | ||
"version": "6.2.0-alpha.3", | ||
"description": "turf points-within-polygon module", | ||
@@ -27,2 +27,6 @@ "author": "Turf Authors", | ||
"module": "dist/es/index.js", | ||
"exports": { | ||
"import": "./dist/es/index.js", | ||
"require": "./dist/js/index.js" | ||
}, | ||
"types": "index.d.ts", | ||
@@ -35,10 +39,9 @@ "sideEffects": false, | ||
"scripts": { | ||
"bench": "npm-run-all prepare bench:run", | ||
"bench:run": "node bench.js", | ||
"bench": "node -r esm bench.js", | ||
"build": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", | ||
"docs": "node ../../scripts/generate-readmes", | ||
"posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", | ||
"prepare": "rollup -c ../../rollup.config.js", | ||
"test": "npm-run-all prepare test:*", | ||
"test": "npm-run-all test:*", | ||
"test:tape": "node -r esm test.js", | ||
"test:types": "tsc --noEmit types.ts" | ||
"test:types": "tsc --esModuleInterop --noEmit types.ts" | ||
}, | ||
@@ -52,7 +55,7 @@ "devDependencies": { | ||
"dependencies": { | ||
"@turf/boolean-point-in-polygon": "^6.2.0-alpha.2", | ||
"@turf/helpers": "^6.2.0-alpha.2", | ||
"@turf/meta": "^6.2.0-alpha.2" | ||
"@turf/boolean-point-in-polygon": "^6.2.0-alpha.3", | ||
"@turf/helpers": "^6.2.0-alpha.3", | ||
"@turf/meta": "^6.2.0-alpha.3" | ||
}, | ||
"gitHead": "23d5cb91d77e0c1e2e903a2252f525797f1d0d09" | ||
"gitHead": "dce9edfc705352e8cb9e0083c9330ba0e8d77409" | ||
} |
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
12526
9
231