@turf/boolean-crosses 6.5.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 +5 -4
- package/dist/es/index.js +5 -4
- package/dist/js/index.d.ts +2 -1
- package/dist/js/index.js +10 -11
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -9,13 +9,14 @@ the maximum dimension of the two source geometries and the intersection set is i
|
|
|
9
9
|
both source geometries.
|
|
10
10
|
|
|
11
11
|
Boolean-Crosses returns t (TRUE) for only multipoint/polygon, multipoint/linestring, linestring/linestring, linestring/polygon, and linestring/multipolygon comparisons.
|
|
12
|
+
Other comparisons are not supported as they are outside the OpenGIS Simple Features spec and may give unexpected results.
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
### Parameters
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
* `feature1` **([Geometry][1] | [Feature][2]\<any>)** GeoJSON Feature or Geometry
|
|
17
|
+
* `feature2` **([Geometry][1] | [Feature][2]\<any>)** GeoJSON Feature or Geometry
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
### Examples
|
|
19
20
|
|
|
20
21
|
```javascript
|
|
21
22
|
var line1 = turf.lineString([[-2, 2], [4, 2]]);
|
package/dist/es/index.js
CHANGED
|
@@ -2,13 +2,14 @@ import lineIntersect from "@turf/line-intersect";
|
|
|
2
2
|
import { polygonToLine } from "@turf/polygon-to-line";
|
|
3
3
|
import booleanPointInPolygon from "@turf/boolean-point-in-polygon";
|
|
4
4
|
import { getGeom } from "@turf/invariant";
|
|
5
|
-
import { point
|
|
5
|
+
import { point } from "@turf/helpers";
|
|
6
6
|
/**
|
|
7
7
|
* Boolean-Crosses returns True if the intersection results in a geometry whose dimension is one less than
|
|
8
8
|
* the maximum dimension of the two source geometries and the intersection set is interior to
|
|
9
9
|
* both source geometries.
|
|
10
10
|
*
|
|
11
11
|
* Boolean-Crosses returns t (TRUE) for only multipoint/polygon, multipoint/linestring, linestring/linestring, linestring/polygon, and linestring/multipolygon comparisons.
|
|
12
|
+
* Other comparisons are not supported as they are outside the OpenGIS Simple Features spec and may give unexpected results.
|
|
12
13
|
*
|
|
13
14
|
* @name booleanCrosses
|
|
14
15
|
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
|
|
@@ -100,8 +101,8 @@ function doLineStringsCross(lineString1, lineString2) {
|
|
|
100
101
|
return false;
|
|
101
102
|
}
|
|
102
103
|
function doLineStringAndPolygonCross(lineString, polygon) {
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
const line = polygonToLine(polygon);
|
|
105
|
+
const doLinesIntersect = lineIntersect(lineString, line);
|
|
105
106
|
if (doLinesIntersect.features.length > 0) {
|
|
106
107
|
return true;
|
|
107
108
|
}
|
|
@@ -111,7 +112,7 @@ function doesMultiPointCrossPoly(multiPoint, polygon) {
|
|
|
111
112
|
var foundIntPoint = false;
|
|
112
113
|
var foundExtPoint = false;
|
|
113
114
|
var pointLength = multiPoint.coordinates.length;
|
|
114
|
-
for (
|
|
115
|
+
for (let i = 0; i < pointLength && (!foundIntPoint || !foundExtPoint); i++) {
|
|
115
116
|
if (booleanPointInPolygon(point(multiPoint.coordinates[i]), polygon)) {
|
|
116
117
|
foundIntPoint = true;
|
|
117
118
|
}
|
package/dist/js/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Feature, Geometry } from "
|
|
1
|
+
import { Feature, Geometry } from "geojson";
|
|
2
2
|
/**
|
|
3
3
|
* Boolean-Crosses returns True if the intersection results in a geometry whose dimension is one less than
|
|
4
4
|
* the maximum dimension of the two source geometries and the intersection set is interior to
|
|
5
5
|
* both source geometries.
|
|
6
6
|
*
|
|
7
7
|
* Boolean-Crosses returns t (TRUE) for only multipoint/polygon, multipoint/linestring, linestring/linestring, linestring/polygon, and linestring/multipolygon comparisons.
|
|
8
|
+
* Other comparisons are not supported as they are outside the OpenGIS Simple Features spec and may give unexpected results.
|
|
8
9
|
*
|
|
9
10
|
* @name booleanCrosses
|
|
10
11
|
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
|
package/dist/js/index.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
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
|
-
|
|
10
|
-
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const line_intersect_1 = tslib_1.__importDefault(require("@turf/line-intersect"));
|
|
5
|
+
const polygon_to_line_1 = require("@turf/polygon-to-line");
|
|
6
|
+
const boolean_point_in_polygon_1 = tslib_1.__importDefault(require("@turf/boolean-point-in-polygon"));
|
|
7
|
+
const invariant_1 = require("@turf/invariant");
|
|
8
|
+
const helpers_1 = require("@turf/helpers");
|
|
11
9
|
/**
|
|
12
10
|
* Boolean-Crosses returns True if the intersection results in a geometry whose dimension is one less than
|
|
13
11
|
* the maximum dimension of the two source geometries and the intersection set is interior to
|
|
14
12
|
* both source geometries.
|
|
15
13
|
*
|
|
16
14
|
* Boolean-Crosses returns t (TRUE) for only multipoint/polygon, multipoint/linestring, linestring/linestring, linestring/polygon, and linestring/multipolygon comparisons.
|
|
15
|
+
* Other comparisons are not supported as they are outside the OpenGIS Simple Features spec and may give unexpected results.
|
|
17
16
|
*
|
|
18
17
|
* @name booleanCrosses
|
|
19
18
|
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
|
|
@@ -105,8 +104,8 @@ function doLineStringsCross(lineString1, lineString2) {
|
|
|
105
104
|
return false;
|
|
106
105
|
}
|
|
107
106
|
function doLineStringAndPolygonCross(lineString, polygon) {
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
const line = polygon_to_line_1.polygonToLine(polygon);
|
|
108
|
+
const doLinesIntersect = line_intersect_1.default(lineString, line);
|
|
110
109
|
if (doLinesIntersect.features.length > 0) {
|
|
111
110
|
return true;
|
|
112
111
|
}
|
|
@@ -116,7 +115,7 @@ function doesMultiPointCrossPoly(multiPoint, polygon) {
|
|
|
116
115
|
var foundIntPoint = false;
|
|
117
116
|
var foundExtPoint = false;
|
|
118
117
|
var pointLength = multiPoint.coordinates.length;
|
|
119
|
-
for (
|
|
118
|
+
for (let i = 0; i < pointLength && (!foundIntPoint || !foundExtPoint); i++) {
|
|
120
119
|
if (boolean_point_in_polygon_1.default(helpers_1.point(multiPoint.coordinates[i]), polygon)) {
|
|
121
120
|
foundIntPoint = true;
|
|
122
121
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/boolean-crosses",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.0",
|
|
4
4
|
"description": "turf boolean-crosses module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -62,11 +62,12 @@
|
|
|
62
62
|
"typescript": "*"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@turf/boolean-point-in-polygon": "^
|
|
66
|
-
"@turf/helpers": "^
|
|
67
|
-
"@turf/invariant": "^
|
|
68
|
-
"@turf/line-intersect": "^
|
|
69
|
-
"@turf/polygon-to-line": "^
|
|
65
|
+
"@turf/boolean-point-in-polygon": "^7.0.0-alpha.0",
|
|
66
|
+
"@turf/helpers": "^7.0.0-alpha.0",
|
|
67
|
+
"@turf/invariant": "^7.0.0-alpha.0",
|
|
68
|
+
"@turf/line-intersect": "^7.0.0-alpha.0",
|
|
69
|
+
"@turf/polygon-to-line": "^7.0.0-alpha.0",
|
|
70
|
+
"tslib": "^2.3.0"
|
|
70
71
|
},
|
|
71
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
|
|
72
73
|
}
|