@turf/boolean-within 6.4.0 → 7.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/es/index.js +2 -2
- package/dist/js/index.d.ts +1 -1
- package/dist/js/index.js +7 -9
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -9,12 +9,12 @@ The interiors of both geometries must intersect and, the interior and boundary o
|
|
|
9
9
|
must not intersect the exterior of the secondary (geometry b).
|
|
10
10
|
Boolean-within returns the exact opposite result of the `@turf/boolean-contains`.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
### Parameters
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
* `feature1` **([Geometry][1] | [Feature][2]\<any>)** GeoJSON Feature or Geometry
|
|
15
|
+
* `feature2` **([Geometry][1] | [Feature][2]\<any>)** GeoJSON Feature or Geometry
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
### Examples
|
|
18
18
|
|
|
19
19
|
```javascript
|
|
20
20
|
var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
|
package/dist/es/index.js
CHANGED
|
@@ -113,13 +113,13 @@ function isMultiPointInPoly(multiPoint, polygon) {
|
|
|
113
113
|
var oneInside = false;
|
|
114
114
|
var isInside = false;
|
|
115
115
|
for (var i = 0; i < multiPoint.coordinates.length; i++) {
|
|
116
|
-
isInside = booleanPointInPolygon(multiPoint.coordinates[
|
|
116
|
+
isInside = booleanPointInPolygon(multiPoint.coordinates[i], polygon);
|
|
117
117
|
if (!isInside) {
|
|
118
118
|
output = false;
|
|
119
119
|
break;
|
|
120
120
|
}
|
|
121
121
|
if (!oneInside) {
|
|
122
|
-
isInside = booleanPointInPolygon(multiPoint.coordinates[
|
|
122
|
+
isInside = booleanPointInPolygon(multiPoint.coordinates[i], polygon, {
|
|
123
123
|
ignoreBoundary: true,
|
|
124
124
|
});
|
|
125
125
|
}
|
package/dist/js/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Feature, Geometry } from "
|
|
1
|
+
import { Feature, Geometry } from "geojson";
|
|
2
2
|
/**
|
|
3
3
|
* Boolean-within returns true if the first geometry is completely within the second geometry.
|
|
4
4
|
* The interiors of both geometries must intersect and, the interior and boundary of the primary (geometry a)
|
package/dist/js/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const bbox_1 = tslib_1.__importDefault(require("@turf/bbox"));
|
|
5
|
+
const boolean_point_on_line_1 = tslib_1.__importDefault(require("@turf/boolean-point-on-line"));
|
|
6
|
+
const boolean_point_in_polygon_1 = tslib_1.__importDefault(require("@turf/boolean-point-in-polygon"));
|
|
7
|
+
const invariant_1 = require("@turf/invariant");
|
|
10
8
|
/**
|
|
11
9
|
* Boolean-within returns true if the first geometry is completely within the second geometry.
|
|
12
10
|
* The interiors of both geometries must intersect and, the interior and boundary of the primary (geometry a)
|
|
@@ -118,13 +116,13 @@ function isMultiPointInPoly(multiPoint, polygon) {
|
|
|
118
116
|
var oneInside = false;
|
|
119
117
|
var isInside = false;
|
|
120
118
|
for (var i = 0; i < multiPoint.coordinates.length; i++) {
|
|
121
|
-
isInside = boolean_point_in_polygon_1.default(multiPoint.coordinates[
|
|
119
|
+
isInside = boolean_point_in_polygon_1.default(multiPoint.coordinates[i], polygon);
|
|
122
120
|
if (!isInside) {
|
|
123
121
|
output = false;
|
|
124
122
|
break;
|
|
125
123
|
}
|
|
126
124
|
if (!oneInside) {
|
|
127
|
-
isInside = boolean_point_in_polygon_1.default(multiPoint.coordinates[
|
|
125
|
+
isInside = boolean_point_in_polygon_1.default(multiPoint.coordinates[i], polygon, {
|
|
128
126
|
ignoreBoundary: true,
|
|
129
127
|
});
|
|
130
128
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/boolean-within",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.0",
|
|
4
4
|
"description": "turf boolean-within module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "git://github.com/Turfjs/turf.git"
|
|
17
17
|
},
|
|
18
|
+
"funding": "https://opencollective.com/turf",
|
|
18
19
|
"publishConfig": {
|
|
19
20
|
"access": "public"
|
|
20
21
|
},
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"docs": "node ../../scripts/generate-readmes",
|
|
49
50
|
"test": "npm-run-all test:*",
|
|
50
51
|
"test:tape": "ts-node -r esm test.js",
|
|
51
|
-
"test:types": "tsc --esModuleInterop --noEmit types.ts"
|
|
52
|
+
"test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@types/tape": "*",
|
|
@@ -64,11 +65,12 @@
|
|
|
64
65
|
"typescript": "*"
|
|
65
66
|
},
|
|
66
67
|
"dependencies": {
|
|
67
|
-
"@turf/bbox": "^
|
|
68
|
-
"@turf/boolean-point-in-polygon": "^
|
|
69
|
-
"@turf/boolean-point-on-line": "^
|
|
70
|
-
"@turf/helpers": "^
|
|
71
|
-
"@turf/invariant": "^
|
|
68
|
+
"@turf/bbox": "^7.0.0-alpha.0",
|
|
69
|
+
"@turf/boolean-point-in-polygon": "^7.0.0-alpha.0",
|
|
70
|
+
"@turf/boolean-point-on-line": "^7.0.0-alpha.0",
|
|
71
|
+
"@turf/helpers": "^7.0.0-alpha.0",
|
|
72
|
+
"@turf/invariant": "^7.0.0-alpha.0",
|
|
73
|
+
"tslib": "^2.3.0"
|
|
72
74
|
},
|
|
73
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
|
|
74
76
|
}
|