@turf/boolean-intersects 7.1.0-alpha.7 → 7.1.0-alpha.70
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 +20 -6
- package/dist/cjs/index.cjs +6 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +19 -6
- package/dist/esm/index.d.ts +19 -6
- package/dist/esm/index.js +6 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -4,30 +4,44 @@
|
|
|
4
4
|
|
|
5
5
|
## booleanIntersects
|
|
6
6
|
|
|
7
|
-
Boolean-intersects returns (TRUE) two geometries
|
|
7
|
+
Boolean-intersects returns (TRUE) if the intersection of the two geometries is NOT an empty set.
|
|
8
8
|
|
|
9
9
|
### Parameters
|
|
10
10
|
|
|
11
11
|
* `feature1` **([Geometry][1] | [Feature][2]\<any>)** GeoJSON Feature or Geometry
|
|
12
12
|
* `feature2` **([Geometry][1] | [Feature][2]\<any>)** GeoJSON Feature or Geometry
|
|
13
|
+
* `options` **[Object][3]** Optional parameters (optional, default `{}`)
|
|
14
|
+
|
|
15
|
+
* `options.ignoreSelfIntersections` **[boolean][4]** ignores self-intersections on input features (optional, default `false`)
|
|
13
16
|
|
|
14
17
|
### Examples
|
|
15
18
|
|
|
16
19
|
```javascript
|
|
17
|
-
var
|
|
18
|
-
var
|
|
20
|
+
var point1 = turf.point([2, 2]);
|
|
21
|
+
var point2 = turf.point([1, 2]);
|
|
22
|
+
var line = turf.lineString([[1, 1], [1, 3], [1, 4]]);
|
|
23
|
+
|
|
24
|
+
turf.booleanIntersects(line, point1);
|
|
25
|
+
//=false
|
|
19
26
|
|
|
20
|
-
turf.booleanIntersects(line,
|
|
27
|
+
turf.booleanIntersects(line, point2);
|
|
21
28
|
//=true
|
|
29
|
+
|
|
30
|
+
//addToMap
|
|
31
|
+
var addToMap = [point1, point2, line];
|
|
32
|
+
point1.properties['marker-color'] = '#f00'
|
|
33
|
+
point2.properties['marker-color'] = '#0f0'
|
|
22
34
|
```
|
|
23
35
|
|
|
24
|
-
Returns **[boolean][
|
|
36
|
+
Returns **[boolean][4]** true if geometries intersect, false otherwise
|
|
25
37
|
|
|
26
38
|
[1]: https://tools.ietf.org/html/rfc7946#section-3.1
|
|
27
39
|
|
|
28
40
|
[2]: https://tools.ietf.org/html/rfc7946#section-3.2
|
|
29
41
|
|
|
30
|
-
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
42
|
+
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
43
|
+
|
|
44
|
+
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
31
45
|
|
|
32
46
|
<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. -->
|
|
33
47
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// index.ts
|
|
2
2
|
var _booleandisjoint = require('@turf/boolean-disjoint');
|
|
3
3
|
var _meta = require('@turf/meta');
|
|
4
|
-
function booleanIntersects(feature1, feature2) {
|
|
4
|
+
function booleanIntersects(feature1, feature2, options = {}) {
|
|
5
|
+
var _a;
|
|
6
|
+
const ignoreSelfIntersections = (_a = options.ignoreSelfIntersections) != null ? _a : false;
|
|
5
7
|
let bool = false;
|
|
6
8
|
_meta.flattenEach.call(void 0, feature1, (flatten1) => {
|
|
7
9
|
_meta.flattenEach.call(void 0, feature2, (flatten2) => {
|
|
8
10
|
if (bool === true) {
|
|
9
11
|
return true;
|
|
10
12
|
}
|
|
11
|
-
bool = !_booleandisjoint.booleanDisjoint.call(void 0, flatten1.geometry, flatten2.geometry
|
|
13
|
+
bool = !_booleandisjoint.booleanDisjoint.call(void 0, flatten1.geometry, flatten2.geometry, {
|
|
14
|
+
ignoreSelfIntersections
|
|
15
|
+
});
|
|
12
16
|
});
|
|
13
17
|
});
|
|
14
18
|
return bool;
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";AACA,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";AACA,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AA2B5B,SAAS,kBACP,UACA,UACA,UAEI,CAAC,GACL;AAnCF;AAoCE,QAAM,2BACJ,aAAQ,4BAAR,YAAmC;AAErC,MAAI,OAAO;AACX,cAAY,UAAU,CAAC,aAAa;AAClC,gBAAY,UAAU,CAAC,aAAa;AAClC,UAAI,SAAS,MAAM;AACjB,eAAO;AAAA,MACT;AACA,aAAO,CAAC,gBAAgB,SAAS,UAAU,SAAS,UAAU;AAAA,QAC5D;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACD,SAAO;AACT;AAGA,IAAO,kCAAQ","sourcesContent":["import { Feature, Geometry } from \"geojson\";\nimport { booleanDisjoint } from \"@turf/boolean-disjoint\";\nimport { flattenEach } from \"@turf/meta\";\n\n/**\n * Boolean-intersects returns (TRUE) if the intersection of the two geometries is NOT an empty set.\n *\n * @name booleanIntersects\n * @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry\n * @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.ignoreSelfIntersections=false] ignores self-intersections on input features\n * @returns {boolean} true if geometries intersect, false otherwise\n * @example\n * var point1 = turf.point([2, 2]);\n * var point2 = turf.point([1, 2]);\n * var line = turf.lineString([[1, 1], [1, 3], [1, 4]]);\n *\n * turf.booleanIntersects(line, point1);\n * //=false\n *\n * turf.booleanIntersects(line, point2);\n * //=true\n *\n * //addToMap\n * var addToMap = [point1, point2, line];\n * point1.properties['marker-color'] = '#f00'\n * point2.properties['marker-color'] = '#0f0'\n */\nfunction booleanIntersects(\n feature1: Feature<any> | Geometry,\n feature2: Feature<any> | Geometry,\n options: {\n ignoreSelfIntersections?: boolean;\n } = {}\n) {\n const ignoreSelfIntersections: boolean =\n options.ignoreSelfIntersections ?? false;\n\n let bool = false;\n flattenEach(feature1, (flatten1) => {\n flattenEach(feature2, (flatten2) => {\n if (bool === true) {\n return true;\n }\n bool = !booleanDisjoint(flatten1.geometry, flatten2.geometry, {\n ignoreSelfIntersections,\n });\n });\n });\n return bool;\n}\n\nexport { booleanIntersects };\nexport default booleanIntersects;\n"]}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
import { Feature, Geometry } from 'geojson';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Boolean-intersects returns (TRUE) two geometries
|
|
4
|
+
* Boolean-intersects returns (TRUE) if the intersection of the two geometries is NOT an empty set.
|
|
5
5
|
*
|
|
6
6
|
* @name booleanIntersects
|
|
7
7
|
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
|
|
8
8
|
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
|
|
9
|
-
* @
|
|
9
|
+
* @param {Object} [options={}] Optional parameters
|
|
10
|
+
* @param {boolean} [options.ignoreSelfIntersections=false] ignores self-intersections on input features
|
|
11
|
+
* @returns {boolean} true if geometries intersect, false otherwise
|
|
10
12
|
* @example
|
|
11
|
-
* var
|
|
12
|
-
* var
|
|
13
|
+
* var point1 = turf.point([2, 2]);
|
|
14
|
+
* var point2 = turf.point([1, 2]);
|
|
15
|
+
* var line = turf.lineString([[1, 1], [1, 3], [1, 4]]);
|
|
13
16
|
*
|
|
14
|
-
* turf.booleanIntersects(line,
|
|
17
|
+
* turf.booleanIntersects(line, point1);
|
|
18
|
+
* //=false
|
|
19
|
+
*
|
|
20
|
+
* turf.booleanIntersects(line, point2);
|
|
15
21
|
* //=true
|
|
22
|
+
*
|
|
23
|
+
* //addToMap
|
|
24
|
+
* var addToMap = [point1, point2, line];
|
|
25
|
+
* point1.properties['marker-color'] = '#f00'
|
|
26
|
+
* point2.properties['marker-color'] = '#0f0'
|
|
16
27
|
*/
|
|
17
|
-
declare function booleanIntersects(feature1: Feature<any> | Geometry, feature2: Feature<any> | Geometry
|
|
28
|
+
declare function booleanIntersects(feature1: Feature<any> | Geometry, feature2: Feature<any> | Geometry, options?: {
|
|
29
|
+
ignoreSelfIntersections?: boolean;
|
|
30
|
+
}): boolean;
|
|
18
31
|
|
|
19
32
|
export { booleanIntersects, booleanIntersects as default };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
import { Feature, Geometry } from 'geojson';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Boolean-intersects returns (TRUE) two geometries
|
|
4
|
+
* Boolean-intersects returns (TRUE) if the intersection of the two geometries is NOT an empty set.
|
|
5
5
|
*
|
|
6
6
|
* @name booleanIntersects
|
|
7
7
|
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
|
|
8
8
|
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
|
|
9
|
-
* @
|
|
9
|
+
* @param {Object} [options={}] Optional parameters
|
|
10
|
+
* @param {boolean} [options.ignoreSelfIntersections=false] ignores self-intersections on input features
|
|
11
|
+
* @returns {boolean} true if geometries intersect, false otherwise
|
|
10
12
|
* @example
|
|
11
|
-
* var
|
|
12
|
-
* var
|
|
13
|
+
* var point1 = turf.point([2, 2]);
|
|
14
|
+
* var point2 = turf.point([1, 2]);
|
|
15
|
+
* var line = turf.lineString([[1, 1], [1, 3], [1, 4]]);
|
|
13
16
|
*
|
|
14
|
-
* turf.booleanIntersects(line,
|
|
17
|
+
* turf.booleanIntersects(line, point1);
|
|
18
|
+
* //=false
|
|
19
|
+
*
|
|
20
|
+
* turf.booleanIntersects(line, point2);
|
|
15
21
|
* //=true
|
|
22
|
+
*
|
|
23
|
+
* //addToMap
|
|
24
|
+
* var addToMap = [point1, point2, line];
|
|
25
|
+
* point1.properties['marker-color'] = '#f00'
|
|
26
|
+
* point2.properties['marker-color'] = '#0f0'
|
|
16
27
|
*/
|
|
17
|
-
declare function booleanIntersects(feature1: Feature<any> | Geometry, feature2: Feature<any> | Geometry
|
|
28
|
+
declare function booleanIntersects(feature1: Feature<any> | Geometry, feature2: Feature<any> | Geometry, options?: {
|
|
29
|
+
ignoreSelfIntersections?: boolean;
|
|
30
|
+
}): boolean;
|
|
18
31
|
|
|
19
32
|
export { booleanIntersects, booleanIntersects as default };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
// index.ts
|
|
2
2
|
import { booleanDisjoint } from "@turf/boolean-disjoint";
|
|
3
3
|
import { flattenEach } from "@turf/meta";
|
|
4
|
-
function booleanIntersects(feature1, feature2) {
|
|
4
|
+
function booleanIntersects(feature1, feature2, options = {}) {
|
|
5
|
+
var _a;
|
|
6
|
+
const ignoreSelfIntersections = (_a = options.ignoreSelfIntersections) != null ? _a : false;
|
|
5
7
|
let bool = false;
|
|
6
8
|
flattenEach(feature1, (flatten1) => {
|
|
7
9
|
flattenEach(feature2, (flatten2) => {
|
|
8
10
|
if (bool === true) {
|
|
9
11
|
return true;
|
|
10
12
|
}
|
|
11
|
-
bool = !booleanDisjoint(flatten1.geometry, flatten2.geometry
|
|
13
|
+
bool = !booleanDisjoint(flatten1.geometry, flatten2.geometry, {
|
|
14
|
+
ignoreSelfIntersections
|
|
15
|
+
});
|
|
12
16
|
});
|
|
13
17
|
});
|
|
14
18
|
return bool;
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, Geometry } from \"geojson\";\nimport { booleanDisjoint } from \"@turf/boolean-disjoint\";\nimport { flattenEach } from \"@turf/meta\";\n\n/**\n * Boolean-intersects returns (TRUE) two geometries
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, Geometry } from \"geojson\";\nimport { booleanDisjoint } from \"@turf/boolean-disjoint\";\nimport { flattenEach } from \"@turf/meta\";\n\n/**\n * Boolean-intersects returns (TRUE) if the intersection of the two geometries is NOT an empty set.\n *\n * @name booleanIntersects\n * @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry\n * @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.ignoreSelfIntersections=false] ignores self-intersections on input features\n * @returns {boolean} true if geometries intersect, false otherwise\n * @example\n * var point1 = turf.point([2, 2]);\n * var point2 = turf.point([1, 2]);\n * var line = turf.lineString([[1, 1], [1, 3], [1, 4]]);\n *\n * turf.booleanIntersects(line, point1);\n * //=false\n *\n * turf.booleanIntersects(line, point2);\n * //=true\n *\n * //addToMap\n * var addToMap = [point1, point2, line];\n * point1.properties['marker-color'] = '#f00'\n * point2.properties['marker-color'] = '#0f0'\n */\nfunction booleanIntersects(\n feature1: Feature<any> | Geometry,\n feature2: Feature<any> | Geometry,\n options: {\n ignoreSelfIntersections?: boolean;\n } = {}\n) {\n const ignoreSelfIntersections: boolean =\n options.ignoreSelfIntersections ?? false;\n\n let bool = false;\n flattenEach(feature1, (flatten1) => {\n flattenEach(feature2, (flatten2) => {\n if (bool === true) {\n return true;\n }\n bool = !booleanDisjoint(flatten1.geometry, flatten2.geometry, {\n ignoreSelfIntersections,\n });\n });\n });\n return bool;\n}\n\nexport { booleanIntersects };\nexport default booleanIntersects;\n"],"mappings":";AACA,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AA2B5B,SAAS,kBACP,UACA,UACA,UAEI,CAAC,GACL;AAnCF;AAoCE,QAAM,2BACJ,aAAQ,4BAAR,YAAmC;AAErC,MAAI,OAAO;AACX,cAAY,UAAU,CAAC,aAAa;AAClC,gBAAY,UAAU,CAAC,aAAa;AAClC,UAAI,SAAS,MAAM;AACjB,eAAO;AAAA,MACT;AACA,aAAO,CAAC,gBAAgB,SAAS,UAAU,SAAS,UAAU;AAAA,QAC5D;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACD,SAAO;AACT;AAGA,IAAO,kCAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/boolean-intersects",
|
|
3
|
-
"version": "7.1.0-alpha.
|
|
3
|
+
"version": "7.1.0-alpha.70+948cdafaf",
|
|
4
4
|
"description": "turf boolean-intersects module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Rowan Winsemius <@rowanwins>",
|
|
8
|
-
"Denis Carriere <@DenisCarriere>"
|
|
8
|
+
"Denis Carriere <@DenisCarriere>",
|
|
9
|
+
"David Whittingham <@01100100>"
|
|
9
10
|
],
|
|
10
11
|
"license": "MIT",
|
|
11
12
|
"bugs": {
|
|
@@ -67,10 +68,11 @@
|
|
|
67
68
|
"typescript": "^5.2.2"
|
|
68
69
|
},
|
|
69
70
|
"dependencies": {
|
|
70
|
-
"@turf/boolean-disjoint": "^7.1.0-alpha.
|
|
71
|
-
"@turf/helpers": "^7.1.0-alpha.
|
|
72
|
-
"@turf/meta": "^7.1.0-alpha.
|
|
71
|
+
"@turf/boolean-disjoint": "^7.1.0-alpha.70+948cdafaf",
|
|
72
|
+
"@turf/helpers": "^7.1.0-alpha.70+948cdafaf",
|
|
73
|
+
"@turf/meta": "^7.1.0-alpha.70+948cdafaf",
|
|
74
|
+
"@types/geojson": "^7946.0.10",
|
|
73
75
|
"tslib": "^2.6.2"
|
|
74
76
|
},
|
|
75
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "948cdafaf70606d2e27fcc79973fa48ee1182067"
|
|
76
78
|
}
|