@turf/boolean-intersects 7.0.0-alpha.1 → 7.0.0-alpha.110
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 +5 -10
- package/dist/cjs/index.cjs +25 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/{js → cjs}/index.d.ts +5 -2
- package/dist/esm/index.d.mts +19 -0
- package/dist/esm/index.mjs +25 -0
- package/dist/esm/index.mjs.map +1 -0
- package/package.json +32 -27
- package/dist/es/index.js +0 -28
- package/dist/es/package.json +0 -1
- package/dist/js/index.js +0 -32
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Boolean-intersects returns (TRUE) two geometries intersect.
|
|
|
14
14
|
### Examples
|
|
15
15
|
|
|
16
16
|
```javascript
|
|
17
|
-
var point = turf.point([
|
|
17
|
+
var point = turf.point([2, 2]);
|
|
18
18
|
var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
|
|
19
19
|
|
|
20
20
|
turf.booleanIntersects(line, point);
|
|
@@ -29,26 +29,21 @@ Returns **[boolean][3]** true/false
|
|
|
29
29
|
|
|
30
30
|
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
31
31
|
|
|
32
|
-
<!-- This file is automatically generated. Please don't edit it directly
|
|
33
|
-
if you find an error, edit the source file (likely index.js), and re-run
|
|
34
|
-
./scripts/generate-readmes in the turf project. -->
|
|
32
|
+
<!-- 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. -->
|
|
35
33
|
|
|
36
34
|
---
|
|
37
35
|
|
|
38
|
-
This module is part of the [Turfjs project](
|
|
39
|
-
module collection dedicated to geographic algorithms. It is maintained in the
|
|
40
|
-
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
|
|
41
|
-
PRs and issues.
|
|
36
|
+
This module is part of the [Turfjs project](https://turfjs.org/), an open source module collection dedicated to geographic algorithms. It is maintained in the [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create PRs and issues.
|
|
42
37
|
|
|
43
38
|
### Installation
|
|
44
39
|
|
|
45
|
-
Install this module individually:
|
|
40
|
+
Install this single module individually:
|
|
46
41
|
|
|
47
42
|
```sh
|
|
48
43
|
$ npm install @turf/boolean-intersects
|
|
49
44
|
```
|
|
50
45
|
|
|
51
|
-
Or install the
|
|
46
|
+
Or install the all-encompassing @turf/turf module that includes all modules as functions:
|
|
52
47
|
|
|
53
48
|
```sh
|
|
54
49
|
$ npm install @turf/turf
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// index.ts
|
|
5
|
+
var _booleandisjoint = require('@turf/boolean-disjoint');
|
|
6
|
+
var _meta = require('@turf/meta');
|
|
7
|
+
function booleanIntersects(feature1, feature2) {
|
|
8
|
+
let bool = false;
|
|
9
|
+
_meta.flattenEach.call(void 0, feature1, (flatten1) => {
|
|
10
|
+
_meta.flattenEach.call(void 0, feature2, (flatten2) => {
|
|
11
|
+
if (bool === true) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
bool = !_booleandisjoint.booleanDisjoint.call(void 0, flatten1.geometry, flatten2.geometry);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
return bool;
|
|
18
|
+
}
|
|
19
|
+
__name(booleanIntersects, "booleanIntersects");
|
|
20
|
+
var turf_boolean_intersects_default = booleanIntersects;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
exports.booleanIntersects = booleanIntersects; exports.default = turf_boolean_intersects_default;
|
|
25
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";;;;AACA,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAgB5B,SAAS,kBACP,UACA,UACA;AACA,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,QAAQ;AAAA,IAC9D,CAAC;AAAA,EACH,CAAC;AACD,SAAO;AACT;AAdS;AAiBT,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) two geometries intersect.\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 * @returns {boolean} true/false\n * @example\n * var point = turf.point([2, 2]);\n * var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);\n *\n * turf.booleanIntersects(line, point);\n * //=true\n */\nfunction booleanIntersects(\n feature1: Feature<any> | Geometry,\n feature2: Feature<any> | Geometry\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 });\n });\n return bool;\n}\n\nexport { booleanIntersects };\nexport default booleanIntersects;\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Feature, Geometry } from
|
|
1
|
+
import { Feature, Geometry } from 'geojson';
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* Boolean-intersects returns (TRUE) two geometries intersect.
|
|
4
5
|
*
|
|
@@ -13,4 +14,6 @@ import { Feature, Geometry } from "geojson";
|
|
|
13
14
|
* turf.booleanIntersects(line, point);
|
|
14
15
|
* //=true
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
+
declare function booleanIntersects(feature1: Feature<any> | Geometry, feature2: Feature<any> | Geometry): boolean;
|
|
18
|
+
|
|
19
|
+
export { booleanIntersects, booleanIntersects as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Feature, Geometry } from 'geojson';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Boolean-intersects returns (TRUE) two geometries intersect.
|
|
5
|
+
*
|
|
6
|
+
* @name booleanIntersects
|
|
7
|
+
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
|
|
8
|
+
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
|
|
9
|
+
* @returns {boolean} true/false
|
|
10
|
+
* @example
|
|
11
|
+
* var point = turf.point([2, 2]);
|
|
12
|
+
* var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
|
|
13
|
+
*
|
|
14
|
+
* turf.booleanIntersects(line, point);
|
|
15
|
+
* //=true
|
|
16
|
+
*/
|
|
17
|
+
declare function booleanIntersects(feature1: Feature<any> | Geometry, feature2: Feature<any> | Geometry): boolean;
|
|
18
|
+
|
|
19
|
+
export { booleanIntersects, booleanIntersects as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// index.ts
|
|
5
|
+
import { booleanDisjoint } from "@turf/boolean-disjoint";
|
|
6
|
+
import { flattenEach } from "@turf/meta";
|
|
7
|
+
function booleanIntersects(feature1, feature2) {
|
|
8
|
+
let bool = false;
|
|
9
|
+
flattenEach(feature1, (flatten1) => {
|
|
10
|
+
flattenEach(feature2, (flatten2) => {
|
|
11
|
+
if (bool === true) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
bool = !booleanDisjoint(flatten1.geometry, flatten2.geometry);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
return bool;
|
|
18
|
+
}
|
|
19
|
+
__name(booleanIntersects, "booleanIntersects");
|
|
20
|
+
var turf_boolean_intersects_default = booleanIntersects;
|
|
21
|
+
export {
|
|
22
|
+
booleanIntersects,
|
|
23
|
+
turf_boolean_intersects_default as default
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +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 intersect.\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 * @returns {boolean} true/false\n * @example\n * var point = turf.point([2, 2]);\n * var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);\n *\n * turf.booleanIntersects(line, point);\n * //=true\n */\nfunction booleanIntersects(\n feature1: Feature<any> | Geometry,\n feature2: Feature<any> | Geometry\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 });\n });\n return bool;\n}\n\nexport { booleanIntersects };\nexport default booleanIntersects;\n"],"mappings":";;;;AACA,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAgB5B,SAAS,kBACP,UACA,UACA;AACA,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,QAAQ;AAAA,IAC9D,CAAC;AAAA,EACH,CAAC;AACD,SAAO;AACT;AAdS;AAiBT,IAAO,kCAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/boolean-intersects",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.110+1411d63a7",
|
|
4
4
|
"description": "turf boolean-intersects module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -26,46 +26,51 @@
|
|
|
26
26
|
"boolean",
|
|
27
27
|
"de-9im"
|
|
28
28
|
],
|
|
29
|
-
"
|
|
30
|
-
"
|
|
29
|
+
"type": "commonjs",
|
|
30
|
+
"main": "dist/cjs/index.cjs",
|
|
31
|
+
"module": "dist/esm/index.mjs",
|
|
32
|
+
"types": "dist/cjs/index.d.ts",
|
|
31
33
|
"exports": {
|
|
32
34
|
"./package.json": "./package.json",
|
|
33
35
|
".": {
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
"import": {
|
|
37
|
+
"types": "./dist/esm/index.d.mts",
|
|
38
|
+
"default": "./dist/esm/index.mjs"
|
|
39
|
+
},
|
|
40
|
+
"require": {
|
|
41
|
+
"types": "./dist/cjs/index.d.ts",
|
|
42
|
+
"default": "./dist/cjs/index.cjs"
|
|
43
|
+
}
|
|
37
44
|
}
|
|
38
45
|
},
|
|
39
|
-
"types": "dist/js/index.d.ts",
|
|
40
46
|
"sideEffects": false,
|
|
41
47
|
"files": [
|
|
42
48
|
"dist"
|
|
43
49
|
],
|
|
44
50
|
"scripts": {
|
|
45
|
-
"bench": "tsx bench.
|
|
46
|
-
"build": "
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"test": "npm-run-all test:*",
|
|
51
|
-
"test:tape": "tsx test.js"
|
|
51
|
+
"bench": "tsx bench.ts",
|
|
52
|
+
"build": "tsup --config ../../tsup.config.ts",
|
|
53
|
+
"docs": "tsx ../../scripts/generate-readmes.ts",
|
|
54
|
+
"test": "npm-run-all --npm-path npm test:*",
|
|
55
|
+
"test:tape": "tsx test.ts"
|
|
52
56
|
},
|
|
53
57
|
"devDependencies": {
|
|
54
|
-
"@types/
|
|
55
|
-
"
|
|
58
|
+
"@types/benchmark": "^2.1.5",
|
|
59
|
+
"@types/tape": "^4.2.32",
|
|
60
|
+
"benchmark": "^2.1.4",
|
|
56
61
|
"boolean-shapely": "*",
|
|
57
|
-
"load-json-file": "
|
|
58
|
-
"npm-run-all": "
|
|
59
|
-
"tape": "
|
|
60
|
-
"
|
|
61
|
-
"tsx": "
|
|
62
|
-
"typescript": "
|
|
62
|
+
"load-json-file": "^7.0.1",
|
|
63
|
+
"npm-run-all": "^4.1.5",
|
|
64
|
+
"tape": "^5.7.2",
|
|
65
|
+
"tsup": "^8.0.1",
|
|
66
|
+
"tsx": "^4.6.2",
|
|
67
|
+
"typescript": "^5.2.2"
|
|
63
68
|
},
|
|
64
69
|
"dependencies": {
|
|
65
|
-
"@turf/boolean-disjoint": "^7.0.0-alpha.
|
|
66
|
-
"@turf/helpers": "^7.0.0-alpha.
|
|
67
|
-
"@turf/meta": "^7.0.0-alpha.
|
|
68
|
-
"tslib": "^2.
|
|
70
|
+
"@turf/boolean-disjoint": "^7.0.0-alpha.110+1411d63a7",
|
|
71
|
+
"@turf/helpers": "^7.0.0-alpha.110+1411d63a7",
|
|
72
|
+
"@turf/meta": "^7.0.0-alpha.110+1411d63a7",
|
|
73
|
+
"tslib": "^2.6.2"
|
|
69
74
|
},
|
|
70
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "1411d63a74c275c9216fe48e9d3cb2d48a359068"
|
|
71
76
|
}
|
package/dist/es/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import booleanDisjoint from "@turf/boolean-disjoint";
|
|
2
|
-
import { flattenEach } from "@turf/meta";
|
|
3
|
-
/**
|
|
4
|
-
* Boolean-intersects returns (TRUE) two geometries intersect.
|
|
5
|
-
*
|
|
6
|
-
* @name booleanIntersects
|
|
7
|
-
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
|
|
8
|
-
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
|
|
9
|
-
* @returns {boolean} true/false
|
|
10
|
-
* @example
|
|
11
|
-
* var point = turf.point([2, 2]);
|
|
12
|
-
* var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
|
|
13
|
-
*
|
|
14
|
-
* turf.booleanIntersects(line, point);
|
|
15
|
-
* //=true
|
|
16
|
-
*/
|
|
17
|
-
export default function booleanIntersects(feature1, feature2) {
|
|
18
|
-
let bool = false;
|
|
19
|
-
flattenEach(feature1, (flatten1) => {
|
|
20
|
-
flattenEach(feature2, (flatten2) => {
|
|
21
|
-
if (bool === true) {
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
bool = !booleanDisjoint(flatten1.geometry, flatten2.geometry);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
return bool;
|
|
28
|
-
}
|
package/dist/es/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"module"}
|
package/dist/js/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const boolean_disjoint_1 = tslib_1.__importDefault(require("@turf/boolean-disjoint"));
|
|
5
|
-
const meta_1 = require("@turf/meta");
|
|
6
|
-
/**
|
|
7
|
-
* Boolean-intersects returns (TRUE) two geometries intersect.
|
|
8
|
-
*
|
|
9
|
-
* @name booleanIntersects
|
|
10
|
-
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
|
|
11
|
-
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
|
|
12
|
-
* @returns {boolean} true/false
|
|
13
|
-
* @example
|
|
14
|
-
* var point = turf.point([2, 2]);
|
|
15
|
-
* var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
|
|
16
|
-
*
|
|
17
|
-
* turf.booleanIntersects(line, point);
|
|
18
|
-
* //=true
|
|
19
|
-
*/
|
|
20
|
-
function booleanIntersects(feature1, feature2) {
|
|
21
|
-
let bool = false;
|
|
22
|
-
meta_1.flattenEach(feature1, (flatten1) => {
|
|
23
|
-
meta_1.flattenEach(feature2, (flatten2) => {
|
|
24
|
-
if (bool === true) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
bool = !boolean_disjoint_1.default(flatten1.geometry, flatten2.geometry);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
return bool;
|
|
31
|
-
}
|
|
32
|
-
exports.default = booleanIntersects;
|