@turf/boolean-within 7.0.0 → 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/dist/cjs/index.cjs +1 -15
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +0 -14
- package/dist/esm/index.js.map +1 -1
- package/package.json +8 -7
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// index.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// index.ts
|
|
5
2
|
var _bbox = require('@turf/bbox');
|
|
6
3
|
var _booleanpointonline = require('@turf/boolean-point-on-line');
|
|
7
4
|
var _booleanpointinpolygon = require('@turf/boolean-point-in-polygon');
|
|
@@ -58,7 +55,6 @@ function booleanWithin(feature1, feature2) {
|
|
|
58
55
|
throw new Error("feature1 " + type1 + " geometry not supported");
|
|
59
56
|
}
|
|
60
57
|
}
|
|
61
|
-
__name(booleanWithin, "booleanWithin");
|
|
62
58
|
function isPointInMultiPoint(point, multiPoint) {
|
|
63
59
|
var i;
|
|
64
60
|
var output = false;
|
|
@@ -70,7 +66,6 @@ function isPointInMultiPoint(point, multiPoint) {
|
|
|
70
66
|
}
|
|
71
67
|
return output;
|
|
72
68
|
}
|
|
73
|
-
__name(isPointInMultiPoint, "isPointInMultiPoint");
|
|
74
69
|
function isMultiPointInMultiPoint(multiPoint1, multiPoint2) {
|
|
75
70
|
for (var i = 0; i < multiPoint1.coordinates.length; i++) {
|
|
76
71
|
var anyMatch = false;
|
|
@@ -85,7 +80,6 @@ function isMultiPointInMultiPoint(multiPoint1, multiPoint2) {
|
|
|
85
80
|
}
|
|
86
81
|
return true;
|
|
87
82
|
}
|
|
88
|
-
__name(isMultiPointInMultiPoint, "isMultiPointInMultiPoint");
|
|
89
83
|
function isMultiPointOnLine(multiPoint, lineString) {
|
|
90
84
|
var foundInsidePoint = false;
|
|
91
85
|
for (var i = 0; i < multiPoint.coordinates.length; i++) {
|
|
@@ -102,7 +96,6 @@ function isMultiPointOnLine(multiPoint, lineString) {
|
|
|
102
96
|
}
|
|
103
97
|
return foundInsidePoint;
|
|
104
98
|
}
|
|
105
|
-
__name(isMultiPointOnLine, "isMultiPointOnLine");
|
|
106
99
|
function isMultiPointInPoly(multiPoint, polygon) {
|
|
107
100
|
var output = true;
|
|
108
101
|
var oneInside = false;
|
|
@@ -121,7 +114,6 @@ function isMultiPointInPoly(multiPoint, polygon) {
|
|
|
121
114
|
}
|
|
122
115
|
return output && isInside;
|
|
123
116
|
}
|
|
124
|
-
__name(isMultiPointInPoly, "isMultiPointInPoly");
|
|
125
117
|
function isLineOnLine(lineString1, lineString2) {
|
|
126
118
|
for (var i = 0; i < lineString1.coordinates.length; i++) {
|
|
127
119
|
if (!_booleanpointonline.booleanPointOnLine.call(void 0, lineString1.coordinates[i], lineString2)) {
|
|
@@ -130,7 +122,6 @@ function isLineOnLine(lineString1, lineString2) {
|
|
|
130
122
|
}
|
|
131
123
|
return true;
|
|
132
124
|
}
|
|
133
|
-
__name(isLineOnLine, "isLineOnLine");
|
|
134
125
|
function isLineInPoly(linestring, polygon) {
|
|
135
126
|
var polyBbox = _bbox.bbox.call(void 0, polygon);
|
|
136
127
|
var lineBbox = _bbox.bbox.call(void 0, linestring);
|
|
@@ -161,7 +152,6 @@ function isLineInPoly(linestring, polygon) {
|
|
|
161
152
|
}
|
|
162
153
|
return foundInsidePoint;
|
|
163
154
|
}
|
|
164
|
-
__name(isLineInPoly, "isLineInPoly");
|
|
165
155
|
function isPolyInPoly(geometry1, geometry2) {
|
|
166
156
|
var poly1Bbox = _bbox.bbox.call(void 0, geometry1);
|
|
167
157
|
var poly2Bbox = _bbox.bbox.call(void 0, geometry2);
|
|
@@ -175,7 +165,6 @@ function isPolyInPoly(geometry1, geometry2) {
|
|
|
175
165
|
}
|
|
176
166
|
return true;
|
|
177
167
|
}
|
|
178
|
-
__name(isPolyInPoly, "isPolyInPoly");
|
|
179
168
|
function doBBoxOverlap(bbox1, bbox2) {
|
|
180
169
|
if (bbox1[0] > bbox2[0])
|
|
181
170
|
return false;
|
|
@@ -187,15 +176,12 @@ function doBBoxOverlap(bbox1, bbox2) {
|
|
|
187
176
|
return false;
|
|
188
177
|
return true;
|
|
189
178
|
}
|
|
190
|
-
__name(doBBoxOverlap, "doBBoxOverlap");
|
|
191
179
|
function compareCoords(pair1, pair2) {
|
|
192
180
|
return pair1[0] === pair2[0] && pair1[1] === pair2[1];
|
|
193
181
|
}
|
|
194
|
-
__name(compareCoords, "compareCoords");
|
|
195
182
|
function getMidpoint(pair1, pair2) {
|
|
196
183
|
return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
|
|
197
184
|
}
|
|
198
|
-
__name(getMidpoint, "getMidpoint");
|
|
199
185
|
var turf_boolean_within_default = booleanWithin;
|
|
200
186
|
|
|
201
187
|
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";;;;AAUA,SAAS,QAAQ,gBAAgB;AACjC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,eAAe;AAmBxB,SAAS,cACP,UACA,UACS;AACT,MAAI,QAAQ,QAAQ,QAAQ;AAC5B,MAAI,QAAQ,QAAQ,QAAQ;AAC5B,MAAI,QAAQ,MAAM;AAClB,MAAI,QAAQ,MAAM;AAElB,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,cAAQ,OAAO;AAAA,QACb,KAAK;AACH,iBAAO,oBAAoB,OAAO,KAAK;AAAA,QACzC,KAAK;AACH,iBAAO,mBAAmB,OAAO,OAAO,EAAE,mBAAmB,KAAK,CAAC;AAAA,QACrE,KAAK;AAAA,QACL,KAAK;AACH,iBAAO,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O;AAChC,MAAI,MAAM,CAAC,IAAI,MAAM,CAAC;AAAG,WAAO;AAChC,SAAO;AACT;AANS;AAgBT,SAAS,cAAc,OAAiB,OAAiB;AACvD,SAAO,MAAM,CAAC,MAAM,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,MAAM,CAAC;AACtD;AAFS;AAYT,SAAS,YAAY,OAAiB,OAAiB;AACrD,SAAO,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC;AAC9D;AAFS;AAKT,IAAO,8BAAQ","sourcesContent":["import {\n BBox,\n Feature,\n Geometry,\n LineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon,\n} from \"geojson\";\nimport { bbox as calcBbox } from \"@turf/bbox\";\nimport { booleanPointOnLine } from \"@turf/boolean-point-on-line\";\nimport { booleanPointInPolygon } from \"@turf/boolean-point-in-polygon\";\nimport { getGeom } from \"@turf/invariant\";\n\n/**\n * Boolean-within returns true if the first geometry is completely within the second geometry.\n * The interiors of both geometries must intersect and, the interior and boundary of the primary (geometry a)\n * must not intersect the exterior of the secondary (geometry b).\n * Boolean-within returns the exact opposite result of the `@turf/boolean-contains`.\n *\n * @name booleanWithin\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 line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);\n * var point = turf.point([1, 2]);\n *\n * turf.booleanWithin(point, line);\n * //=true\n */\nfunction booleanWithin(\n feature1: Feature<any> | Geometry,\n feature2: Feature<any> | Geometry\n): boolean {\n var geom1 = getGeom(feature1);\n var geom2 = getGeom(feature2);\n var type1 = geom1.type;\n var type2 = geom2.type;\n\n switch (type1) {\n case \"Point\":\n switch (type2) {\n case \"MultiPoint\":\n return isPointInMultiPoint(geom1, geom2);\n case \"LineString\":\n return booleanPointOnLine(geom1, geom2, { ignoreEndVertices: true });\n case \"Polygon\":\n case \"MultiPolygon\":\n return booleanPointInPolygon(geom1, geom2, { ignoreBoundary: true });\n default:\n throw new Error(\"feature2 \" + type2 + \" geometry not supported\");\n }\n case \"MultiPoint\":\n switch (type2) {\n case \"MultiPoint\":\n return isMultiPointInMultiPoint(geom1, geom2);\n case \"LineString\":\n return isMultiPointOnLine(geom1, geom2);\n case \"Polygon\":\n case \"MultiPolygon\":\n return isMultiPointInPoly(geom1, geom2);\n default:\n throw new Error(\"feature2 \" + type2 + \" geometry not supported\");\n }\n case \"LineString\":\n switch (type2) {\n case \"LineString\":\n return isLineOnLine(geom1, geom2);\n case \"Polygon\":\n case \"MultiPolygon\":\n return isLineInPoly(geom1, geom2);\n default:\n throw new Error(\"feature2 \" + type2 + \" geometry not supported\");\n }\n case \"Polygon\":\n switch (type2) {\n case \"Polygon\":\n case \"MultiPolygon\":\n return isPolyInPoly(geom1, geom2);\n default:\n throw new Error(\"feature2 \" + type2 + \" geometry not supported\");\n }\n default:\n throw new Error(\"feature1 \" + type1 + \" geometry not supported\");\n }\n}\n\nfunction isPointInMultiPoint(point: Point, multiPoint: MultiPoint) {\n var i;\n var output = false;\n for (i = 0; i < multiPoint.coordinates.length; i++) {\n if (compareCoords(multiPoint.coordinates[i], point.coordinates)) {\n output = true;\n break;\n }\n }\n return output;\n}\n\nfunction isMultiPointInMultiPoint(\n multiPoint1: MultiPoint,\n multiPoint2: MultiPoint\n) {\n for (var i = 0; i < multiPoint1.coordinates.length; i++) {\n var anyMatch = false;\n for (var i2 = 0; i2 < multiPoint2.coordinates.length; i2++) {\n if (\n compareCoords(multiPoint1.coordinates[i], multiPoint2.coordinates[i2])\n ) {\n anyMatch = true;\n }\n }\n if (!anyMatch) {\n return false;\n }\n }\n return true;\n}\n\nfunction isMultiPointOnLine(multiPoint: MultiPoint, lineString: LineString) {\n var foundInsidePoint = false;\n\n for (var i = 0; i < multiPoint.coordinates.length; i++) {\n if (!booleanPointOnLine(multiPoint.coordinates[i], lineString)) {\n return false;\n }\n if (!foundInsidePoint) {\n foundInsidePoint = booleanPointOnLine(\n multiPoint.coordinates[i],\n lineString,\n { ignoreEndVertices: true }\n );\n }\n }\n return foundInsidePoint;\n}\n\nfunction isMultiPointInPoly(multiPoint: MultiPoint, polygon: Polygon) {\n var output = true;\n var oneInside = false;\n var isInside = false;\n for (var i = 0; i < multiPoint.coordinates.length; i++) {\n isInside = booleanPointInPolygon(multiPoint.coordinates[i], polygon);\n if (!isInside) {\n output = false;\n break;\n }\n if (!oneInside) {\n isInside = booleanPointInPolygon(multiPoint.coordinates[i], polygon, {\n ignoreBoundary: true,\n });\n }\n }\n return output && isInside;\n}\n\nfunction isLineOnLine(lineString1: LineString, lineString2: LineString) {\n for (var i = 0; i < lineString1.coordinates.length; i++) {\n if (!booleanPointOnLine(lineString1.coordinates[i], lineString2)) {\n return false;\n }\n }\n return true;\n}\n\nfunction isLineInPoly(linestring: LineString, polygon: Polygon) {\n var polyBbox = calcBbox(polygon);\n var lineBbox = calcBbox(linestring);\n if (!doBBoxOverlap(polyBbox, lineBbox)) {\n return false;\n }\n var foundInsidePoint = false;\n\n for (var i = 0; i < linestring.coordinates.length; i++) {\n if (!booleanPointInPolygon(linestring.coordinates[i], polygon)) {\n return false;\n }\n if (!foundInsidePoint) {\n foundInsidePoint = booleanPointInPolygon(\n linestring.coordinates[i],\n polygon,\n { ignoreBoundary: true }\n );\n }\n if (!foundInsidePoint && i < linestring.coordinates.length - 1) {\n var midpoint = getMidpoint(\n linestring.coordinates[i],\n linestring.coordinates[i + 1]\n );\n foundInsidePoint = booleanPointInPolygon(midpoint, polygon, {\n ignoreBoundary: true,\n });\n }\n }\n return foundInsidePoint;\n}\n\n/**\n * Is Polygon2 in Polygon1\n * Only takes into account outer rings\n *\n * @private\n * @param {Polygon} geometry1\n * @param {Polygon|MultiPolygon} geometry2\n * @returns {boolean} true/false\n */\nfunction isPolyInPoly(geometry1: Polygon, geometry2: Polygon | MultiPolygon) {\n var poly1Bbox = calcBbox(geometry1);\n var poly2Bbox = calcBbox(geometry2);\n if (!doBBoxOverlap(poly2Bbox, poly1Bbox)) {\n return false;\n }\n for (var i = 0; i < geometry1.coordinates[0].length; i++) {\n if (!booleanPointInPolygon(geometry1.coordinates[0][i], geometry2)) {\n return false;\n }\n }\n return true;\n}\n\nfunction doBBoxOverlap(bbox1: BBox, bbox2: BBox) {\n if (bbox1[0] > bbox2[0]) return false;\n if (bbox1[2] < bbox2[2]) return false;\n if (bbox1[1] > bbox2[1]) return false;\n if (bbox1[3] < bbox2[3]) return false;\n return true;\n}\n\n/**\n * compareCoords\n *\n * @private\n * @param {Position} pair1 point [x,y]\n * @param {Position} pair2 point [x,y]\n * @returns {boolean} true/false if coord pairs match\n */\nfunction compareCoords(pair1: number[], pair2: number[]) {\n return pair1[0] === pair2[0] && pair1[1] === pair2[1];\n}\n\n/**\n * getMidpoint\n *\n * @private\n * @param {Position} pair1 point [x,y]\n * @param {Position} pair2 point [x,y]\n * @returns {Position} midpoint of pair1 and pair2\n */\nfunction getMidpoint(pair1: number[], pair2: number[]) {\n return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];\n}\n\nexport { booleanWithin };\nexport default booleanWithin;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";AAUA,SAAS,QAAQ,gBAAgB;AACjC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,eAAe;AAmBxB,SAAS,cACP,UACA,UACS;AACT,MAAI,QAAQ,QAAQ,QAAQ;AAC5B,MAAI,QAAQ,QAAQ,QAAQ;AAC5B,MAAI,QAAQ,MAAM;AAClB,MAAI,QAAQ,MAAM;AAElB,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,cAAQ,OAAO;AAAA,QACb,KAAK;AACH,iBAAO,oBAAoB,OAAO,KAAK;AAAA,QACzC,KAAK;AACH,iBAAO,mBAAmB,OAAO,OAAO,EAAE,mBAAmB,KAAK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ChC,MAAI,MAAM,CAAC,IAAI,MAAM,CAAC;AAAG,WAAO;AAChC,SAAO;AACT;AAUA,SAAS,cAAc,OAAiB,OAAiB;AACvD,SAAO,MAAM,CAAC,MAAM,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,MAAM,CAAC;AACtD;AAUA,SAAS,YAAY,OAAiB,OAAiB;AACrD,SAAO,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC;AAC9D;AAGA,IAAO,8BAAQ","sourcesContent":["import {\n BBox,\n Feature,\n Geometry,\n LineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon,\n} from \"geojson\";\nimport { bbox as calcBbox } from \"@turf/bbox\";\nimport { booleanPointOnLine } from \"@turf/boolean-point-on-line\";\nimport { booleanPointInPolygon } from \"@turf/boolean-point-in-polygon\";\nimport { getGeom } from \"@turf/invariant\";\n\n/**\n * Boolean-within returns true if the first geometry is completely within the second geometry.\n * The interiors of both geometries must intersect and, the interior and boundary of the primary (geometry a)\n * must not intersect the exterior of the secondary (geometry b).\n * Boolean-within returns the exact opposite result of the `@turf/boolean-contains`.\n *\n * @name booleanWithin\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 line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);\n * var point = turf.point([1, 2]);\n *\n * turf.booleanWithin(point, line);\n * //=true\n */\nfunction booleanWithin(\n feature1: Feature<any> | Geometry,\n feature2: Feature<any> | Geometry\n): boolean {\n var geom1 = getGeom(feature1);\n var geom2 = getGeom(feature2);\n var type1 = geom1.type;\n var type2 = geom2.type;\n\n switch (type1) {\n case \"Point\":\n switch (type2) {\n case \"MultiPoint\":\n return isPointInMultiPoint(geom1, geom2);\n case \"LineString\":\n return booleanPointOnLine(geom1, geom2, { ignoreEndVertices: true });\n case \"Polygon\":\n case \"MultiPolygon\":\n return booleanPointInPolygon(geom1, geom2, { ignoreBoundary: true });\n default:\n throw new Error(\"feature2 \" + type2 + \" geometry not supported\");\n }\n case \"MultiPoint\":\n switch (type2) {\n case \"MultiPoint\":\n return isMultiPointInMultiPoint(geom1, geom2);\n case \"LineString\":\n return isMultiPointOnLine(geom1, geom2);\n case \"Polygon\":\n case \"MultiPolygon\":\n return isMultiPointInPoly(geom1, geom2);\n default:\n throw new Error(\"feature2 \" + type2 + \" geometry not supported\");\n }\n case \"LineString\":\n switch (type2) {\n case \"LineString\":\n return isLineOnLine(geom1, geom2);\n case \"Polygon\":\n case \"MultiPolygon\":\n return isLineInPoly(geom1, geom2);\n default:\n throw new Error(\"feature2 \" + type2 + \" geometry not supported\");\n }\n case \"Polygon\":\n switch (type2) {\n case \"Polygon\":\n case \"MultiPolygon\":\n return isPolyInPoly(geom1, geom2);\n default:\n throw new Error(\"feature2 \" + type2 + \" geometry not supported\");\n }\n default:\n throw new Error(\"feature1 \" + type1 + \" geometry not supported\");\n }\n}\n\nfunction isPointInMultiPoint(point: Point, multiPoint: MultiPoint) {\n var i;\n var output = false;\n for (i = 0; i < multiPoint.coordinates.length; i++) {\n if (compareCoords(multiPoint.coordinates[i], point.coordinates)) {\n output = true;\n break;\n }\n }\n return output;\n}\n\nfunction isMultiPointInMultiPoint(\n multiPoint1: MultiPoint,\n multiPoint2: MultiPoint\n) {\n for (var i = 0; i < multiPoint1.coordinates.length; i++) {\n var anyMatch = false;\n for (var i2 = 0; i2 < multiPoint2.coordinates.length; i2++) {\n if (\n compareCoords(multiPoint1.coordinates[i], multiPoint2.coordinates[i2])\n ) {\n anyMatch = true;\n }\n }\n if (!anyMatch) {\n return false;\n }\n }\n return true;\n}\n\nfunction isMultiPointOnLine(multiPoint: MultiPoint, lineString: LineString) {\n var foundInsidePoint = false;\n\n for (var i = 0; i < multiPoint.coordinates.length; i++) {\n if (!booleanPointOnLine(multiPoint.coordinates[i], lineString)) {\n return false;\n }\n if (!foundInsidePoint) {\n foundInsidePoint = booleanPointOnLine(\n multiPoint.coordinates[i],\n lineString,\n { ignoreEndVertices: true }\n );\n }\n }\n return foundInsidePoint;\n}\n\nfunction isMultiPointInPoly(multiPoint: MultiPoint, polygon: Polygon) {\n var output = true;\n var oneInside = false;\n var isInside = false;\n for (var i = 0; i < multiPoint.coordinates.length; i++) {\n isInside = booleanPointInPolygon(multiPoint.coordinates[i], polygon);\n if (!isInside) {\n output = false;\n break;\n }\n if (!oneInside) {\n isInside = booleanPointInPolygon(multiPoint.coordinates[i], polygon, {\n ignoreBoundary: true,\n });\n }\n }\n return output && isInside;\n}\n\nfunction isLineOnLine(lineString1: LineString, lineString2: LineString) {\n for (var i = 0; i < lineString1.coordinates.length; i++) {\n if (!booleanPointOnLine(lineString1.coordinates[i], lineString2)) {\n return false;\n }\n }\n return true;\n}\n\nfunction isLineInPoly(linestring: LineString, polygon: Polygon) {\n var polyBbox = calcBbox(polygon);\n var lineBbox = calcBbox(linestring);\n if (!doBBoxOverlap(polyBbox, lineBbox)) {\n return false;\n }\n var foundInsidePoint = false;\n\n for (var i = 0; i < linestring.coordinates.length; i++) {\n if (!booleanPointInPolygon(linestring.coordinates[i], polygon)) {\n return false;\n }\n if (!foundInsidePoint) {\n foundInsidePoint = booleanPointInPolygon(\n linestring.coordinates[i],\n polygon,\n { ignoreBoundary: true }\n );\n }\n if (!foundInsidePoint && i < linestring.coordinates.length - 1) {\n var midpoint = getMidpoint(\n linestring.coordinates[i],\n linestring.coordinates[i + 1]\n );\n foundInsidePoint = booleanPointInPolygon(midpoint, polygon, {\n ignoreBoundary: true,\n });\n }\n }\n return foundInsidePoint;\n}\n\n/**\n * Is Polygon2 in Polygon1\n * Only takes into account outer rings\n *\n * @private\n * @param {Polygon} geometry1\n * @param {Polygon|MultiPolygon} geometry2\n * @returns {boolean} true/false\n */\nfunction isPolyInPoly(geometry1: Polygon, geometry2: Polygon | MultiPolygon) {\n var poly1Bbox = calcBbox(geometry1);\n var poly2Bbox = calcBbox(geometry2);\n if (!doBBoxOverlap(poly2Bbox, poly1Bbox)) {\n return false;\n }\n for (var i = 0; i < geometry1.coordinates[0].length; i++) {\n if (!booleanPointInPolygon(geometry1.coordinates[0][i], geometry2)) {\n return false;\n }\n }\n return true;\n}\n\nfunction doBBoxOverlap(bbox1: BBox, bbox2: BBox) {\n if (bbox1[0] > bbox2[0]) return false;\n if (bbox1[2] < bbox2[2]) return false;\n if (bbox1[1] > bbox2[1]) return false;\n if (bbox1[3] < bbox2[3]) return false;\n return true;\n}\n\n/**\n * compareCoords\n *\n * @private\n * @param {Position} pair1 point [x,y]\n * @param {Position} pair2 point [x,y]\n * @returns {boolean} true/false if coord pairs match\n */\nfunction compareCoords(pair1: number[], pair2: number[]) {\n return pair1[0] === pair2[0] && pair1[1] === pair2[1];\n}\n\n/**\n * getMidpoint\n *\n * @private\n * @param {Position} pair1 point [x,y]\n * @param {Position} pair2 point [x,y]\n * @returns {Position} midpoint of pair1 and pair2\n */\nfunction getMidpoint(pair1: number[], pair2: number[]) {\n return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];\n}\n\nexport { booleanWithin };\nexport default booleanWithin;\n"]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// index.ts
|
|
5
2
|
import { bbox as calcBbox } from "@turf/bbox";
|
|
6
3
|
import { booleanPointOnLine } from "@turf/boolean-point-on-line";
|
|
@@ -58,7 +55,6 @@ function booleanWithin(feature1, feature2) {
|
|
|
58
55
|
throw new Error("feature1 " + type1 + " geometry not supported");
|
|
59
56
|
}
|
|
60
57
|
}
|
|
61
|
-
__name(booleanWithin, "booleanWithin");
|
|
62
58
|
function isPointInMultiPoint(point, multiPoint) {
|
|
63
59
|
var i;
|
|
64
60
|
var output = false;
|
|
@@ -70,7 +66,6 @@ function isPointInMultiPoint(point, multiPoint) {
|
|
|
70
66
|
}
|
|
71
67
|
return output;
|
|
72
68
|
}
|
|
73
|
-
__name(isPointInMultiPoint, "isPointInMultiPoint");
|
|
74
69
|
function isMultiPointInMultiPoint(multiPoint1, multiPoint2) {
|
|
75
70
|
for (var i = 0; i < multiPoint1.coordinates.length; i++) {
|
|
76
71
|
var anyMatch = false;
|
|
@@ -85,7 +80,6 @@ function isMultiPointInMultiPoint(multiPoint1, multiPoint2) {
|
|
|
85
80
|
}
|
|
86
81
|
return true;
|
|
87
82
|
}
|
|
88
|
-
__name(isMultiPointInMultiPoint, "isMultiPointInMultiPoint");
|
|
89
83
|
function isMultiPointOnLine(multiPoint, lineString) {
|
|
90
84
|
var foundInsidePoint = false;
|
|
91
85
|
for (var i = 0; i < multiPoint.coordinates.length; i++) {
|
|
@@ -102,7 +96,6 @@ function isMultiPointOnLine(multiPoint, lineString) {
|
|
|
102
96
|
}
|
|
103
97
|
return foundInsidePoint;
|
|
104
98
|
}
|
|
105
|
-
__name(isMultiPointOnLine, "isMultiPointOnLine");
|
|
106
99
|
function isMultiPointInPoly(multiPoint, polygon) {
|
|
107
100
|
var output = true;
|
|
108
101
|
var oneInside = false;
|
|
@@ -121,7 +114,6 @@ function isMultiPointInPoly(multiPoint, polygon) {
|
|
|
121
114
|
}
|
|
122
115
|
return output && isInside;
|
|
123
116
|
}
|
|
124
|
-
__name(isMultiPointInPoly, "isMultiPointInPoly");
|
|
125
117
|
function isLineOnLine(lineString1, lineString2) {
|
|
126
118
|
for (var i = 0; i < lineString1.coordinates.length; i++) {
|
|
127
119
|
if (!booleanPointOnLine(lineString1.coordinates[i], lineString2)) {
|
|
@@ -130,7 +122,6 @@ function isLineOnLine(lineString1, lineString2) {
|
|
|
130
122
|
}
|
|
131
123
|
return true;
|
|
132
124
|
}
|
|
133
|
-
__name(isLineOnLine, "isLineOnLine");
|
|
134
125
|
function isLineInPoly(linestring, polygon) {
|
|
135
126
|
var polyBbox = calcBbox(polygon);
|
|
136
127
|
var lineBbox = calcBbox(linestring);
|
|
@@ -161,7 +152,6 @@ function isLineInPoly(linestring, polygon) {
|
|
|
161
152
|
}
|
|
162
153
|
return foundInsidePoint;
|
|
163
154
|
}
|
|
164
|
-
__name(isLineInPoly, "isLineInPoly");
|
|
165
155
|
function isPolyInPoly(geometry1, geometry2) {
|
|
166
156
|
var poly1Bbox = calcBbox(geometry1);
|
|
167
157
|
var poly2Bbox = calcBbox(geometry2);
|
|
@@ -175,7 +165,6 @@ function isPolyInPoly(geometry1, geometry2) {
|
|
|
175
165
|
}
|
|
176
166
|
return true;
|
|
177
167
|
}
|
|
178
|
-
__name(isPolyInPoly, "isPolyInPoly");
|
|
179
168
|
function doBBoxOverlap(bbox1, bbox2) {
|
|
180
169
|
if (bbox1[0] > bbox2[0])
|
|
181
170
|
return false;
|
|
@@ -187,15 +176,12 @@ function doBBoxOverlap(bbox1, bbox2) {
|
|
|
187
176
|
return false;
|
|
188
177
|
return true;
|
|
189
178
|
}
|
|
190
|
-
__name(doBBoxOverlap, "doBBoxOverlap");
|
|
191
179
|
function compareCoords(pair1, pair2) {
|
|
192
180
|
return pair1[0] === pair2[0] && pair1[1] === pair2[1];
|
|
193
181
|
}
|
|
194
|
-
__name(compareCoords, "compareCoords");
|
|
195
182
|
function getMidpoint(pair1, pair2) {
|
|
196
183
|
return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
|
|
197
184
|
}
|
|
198
|
-
__name(getMidpoint, "getMidpoint");
|
|
199
185
|
var turf_boolean_within_default = booleanWithin;
|
|
200
186
|
export {
|
|
201
187
|
booleanWithin,
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import {\n BBox,\n Feature,\n Geometry,\n LineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon,\n} from \"geojson\";\nimport { bbox as calcBbox } from \"@turf/bbox\";\nimport { booleanPointOnLine } from \"@turf/boolean-point-on-line\";\nimport { booleanPointInPolygon } from \"@turf/boolean-point-in-polygon\";\nimport { getGeom } from \"@turf/invariant\";\n\n/**\n * Boolean-within returns true if the first geometry is completely within the second geometry.\n * The interiors of both geometries must intersect and, the interior and boundary of the primary (geometry a)\n * must not intersect the exterior of the secondary (geometry b).\n * Boolean-within returns the exact opposite result of the `@turf/boolean-contains`.\n *\n * @name booleanWithin\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 line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);\n * var point = turf.point([1, 2]);\n *\n * turf.booleanWithin(point, line);\n * //=true\n */\nfunction booleanWithin(\n feature1: Feature<any> | Geometry,\n feature2: Feature<any> | Geometry\n): boolean {\n var geom1 = getGeom(feature1);\n var geom2 = getGeom(feature2);\n var type1 = geom1.type;\n var type2 = geom2.type;\n\n switch (type1) {\n case \"Point\":\n switch (type2) {\n case \"MultiPoint\":\n return isPointInMultiPoint(geom1, geom2);\n case \"LineString\":\n return booleanPointOnLine(geom1, geom2, { ignoreEndVertices: true });\n case \"Polygon\":\n case \"MultiPolygon\":\n return booleanPointInPolygon(geom1, geom2, { ignoreBoundary: true });\n default:\n throw new Error(\"feature2 \" + type2 + \" geometry not supported\");\n }\n case \"MultiPoint\":\n switch (type2) {\n case \"MultiPoint\":\n return isMultiPointInMultiPoint(geom1, geom2);\n case \"LineString\":\n return isMultiPointOnLine(geom1, geom2);\n case \"Polygon\":\n case \"MultiPolygon\":\n return isMultiPointInPoly(geom1, geom2);\n default:\n throw new Error(\"feature2 \" + type2 + \" geometry not supported\");\n }\n case \"LineString\":\n switch (type2) {\n case \"LineString\":\n return isLineOnLine(geom1, geom2);\n case \"Polygon\":\n case \"MultiPolygon\":\n return isLineInPoly(geom1, geom2);\n default:\n throw new Error(\"feature2 \" + type2 + \" geometry not supported\");\n }\n case \"Polygon\":\n switch (type2) {\n case \"Polygon\":\n case \"MultiPolygon\":\n return isPolyInPoly(geom1, geom2);\n default:\n throw new Error(\"feature2 \" + type2 + \" geometry not supported\");\n }\n default:\n throw new Error(\"feature1 \" + type1 + \" geometry not supported\");\n }\n}\n\nfunction isPointInMultiPoint(point: Point, multiPoint: MultiPoint) {\n var i;\n var output = false;\n for (i = 0; i < multiPoint.coordinates.length; i++) {\n if (compareCoords(multiPoint.coordinates[i], point.coordinates)) {\n output = true;\n break;\n }\n }\n return output;\n}\n\nfunction isMultiPointInMultiPoint(\n multiPoint1: MultiPoint,\n multiPoint2: MultiPoint\n) {\n for (var i = 0; i < multiPoint1.coordinates.length; i++) {\n var anyMatch = false;\n for (var i2 = 0; i2 < multiPoint2.coordinates.length; i2++) {\n if (\n compareCoords(multiPoint1.coordinates[i], multiPoint2.coordinates[i2])\n ) {\n anyMatch = true;\n }\n }\n if (!anyMatch) {\n return false;\n }\n }\n return true;\n}\n\nfunction isMultiPointOnLine(multiPoint: MultiPoint, lineString: LineString) {\n var foundInsidePoint = false;\n\n for (var i = 0; i < multiPoint.coordinates.length; i++) {\n if (!booleanPointOnLine(multiPoint.coordinates[i], lineString)) {\n return false;\n }\n if (!foundInsidePoint) {\n foundInsidePoint = booleanPointOnLine(\n multiPoint.coordinates[i],\n lineString,\n { ignoreEndVertices: true }\n );\n }\n }\n return foundInsidePoint;\n}\n\nfunction isMultiPointInPoly(multiPoint: MultiPoint, polygon: Polygon) {\n var output = true;\n var oneInside = false;\n var isInside = false;\n for (var i = 0; i < multiPoint.coordinates.length; i++) {\n isInside = booleanPointInPolygon(multiPoint.coordinates[i], polygon);\n if (!isInside) {\n output = false;\n break;\n }\n if (!oneInside) {\n isInside = booleanPointInPolygon(multiPoint.coordinates[i], polygon, {\n ignoreBoundary: true,\n });\n }\n }\n return output && isInside;\n}\n\nfunction isLineOnLine(lineString1: LineString, lineString2: LineString) {\n for (var i = 0; i < lineString1.coordinates.length; i++) {\n if (!booleanPointOnLine(lineString1.coordinates[i], lineString2)) {\n return false;\n }\n }\n return true;\n}\n\nfunction isLineInPoly(linestring: LineString, polygon: Polygon) {\n var polyBbox = calcBbox(polygon);\n var lineBbox = calcBbox(linestring);\n if (!doBBoxOverlap(polyBbox, lineBbox)) {\n return false;\n }\n var foundInsidePoint = false;\n\n for (var i = 0; i < linestring.coordinates.length; i++) {\n if (!booleanPointInPolygon(linestring.coordinates[i], polygon)) {\n return false;\n }\n if (!foundInsidePoint) {\n foundInsidePoint = booleanPointInPolygon(\n linestring.coordinates[i],\n polygon,\n { ignoreBoundary: true }\n );\n }\n if (!foundInsidePoint && i < linestring.coordinates.length - 1) {\n var midpoint = getMidpoint(\n linestring.coordinates[i],\n linestring.coordinates[i + 1]\n );\n foundInsidePoint = booleanPointInPolygon(midpoint, polygon, {\n ignoreBoundary: true,\n });\n }\n }\n return foundInsidePoint;\n}\n\n/**\n * Is Polygon2 in Polygon1\n * Only takes into account outer rings\n *\n * @private\n * @param {Polygon} geometry1\n * @param {Polygon|MultiPolygon} geometry2\n * @returns {boolean} true/false\n */\nfunction isPolyInPoly(geometry1: Polygon, geometry2: Polygon | MultiPolygon) {\n var poly1Bbox = calcBbox(geometry1);\n var poly2Bbox = calcBbox(geometry2);\n if (!doBBoxOverlap(poly2Bbox, poly1Bbox)) {\n return false;\n }\n for (var i = 0; i < geometry1.coordinates[0].length; i++) {\n if (!booleanPointInPolygon(geometry1.coordinates[0][i], geometry2)) {\n return false;\n }\n }\n return true;\n}\n\nfunction doBBoxOverlap(bbox1: BBox, bbox2: BBox) {\n if (bbox1[0] > bbox2[0]) return false;\n if (bbox1[2] < bbox2[2]) return false;\n if (bbox1[1] > bbox2[1]) return false;\n if (bbox1[3] < bbox2[3]) return false;\n return true;\n}\n\n/**\n * compareCoords\n *\n * @private\n * @param {Position} pair1 point [x,y]\n * @param {Position} pair2 point [x,y]\n * @returns {boolean} true/false if coord pairs match\n */\nfunction compareCoords(pair1: number[], pair2: number[]) {\n return pair1[0] === pair2[0] && pair1[1] === pair2[1];\n}\n\n/**\n * getMidpoint\n *\n * @private\n * @param {Position} pair1 point [x,y]\n * @param {Position} pair2 point [x,y]\n * @returns {Position} midpoint of pair1 and pair2\n */\nfunction getMidpoint(pair1: number[], pair2: number[]) {\n return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];\n}\n\nexport { booleanWithin };\nexport default booleanWithin;\n"],"mappings":";;;;AAUA,SAAS,QAAQ,gBAAgB;AACjC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,eAAe;AAmBxB,SAAS,cACP,UACA,UACS;AACT,MAAI,QAAQ,QAAQ,QAAQ;AAC5B,MAAI,QAAQ,QAAQ,QAAQ;AAC5B,MAAI,QAAQ,MAAM;AAClB,MAAI,QAAQ,MAAM;AAElB,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,cAAQ,OAAO;AAAA,QACb,KAAK;AACH,iBAAO,oBAAoB,OAAO,KAAK;AAAA,QACzC,KAAK;AACH,iBAAO,mBAAmB,OAAO,OAAO,EAAE,mBAAmB,KAAK,CAAC;AAAA,QACrE,KAAK;AAAA,QACL,KAAK;AACH,iBAAO,sBAAsB,OAAO,OAAO,EAAE,gBAAgB,KAAK,CAAC;AAAA,QACrE;AACE,gBAAM,IAAI,MAAM,cAAc,QAAQ,yBAAyB;AAAA,MACnE;AAAA,IACF,KAAK;AACH,cAAQ,OAAO;AAAA,QACb,KAAK;AACH,iBAAO,yBAAyB,OAAO,KAAK;AAAA,QAC9C,KAAK;AACH,iBAAO,mBAAmB,OAAO,KAAK;AAAA,QACxC,KAAK;AAAA,QACL,KAAK;AACH,iBAAO,mBAAmB,OAAO,KAAK;AAAA,QACxC;AACE,gBAAM,IAAI,MAAM,cAAc,QAAQ,yBAAyB;AAAA,MACnE;AAAA,IACF,KAAK;AACH,cAAQ,OAAO;AAAA,QACb,KAAK;AACH,iBAAO,aAAa,OAAO,KAAK;AAA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olygon,\n Point,\n Polygon,\n} from \"geojson\";\nimport { bbox as calcBbox } from \"@turf/bbox\";\nimport { booleanPointOnLine } from \"@turf/boolean-point-on-line\";\nimport { booleanPointInPolygon } from \"@turf/boolean-point-in-polygon\";\nimport { getGeom } from \"@turf/invariant\";\n\n/**\n * Boolean-within returns true if the first geometry is completely within the second geometry.\n * The interiors of both geometries must intersect and, the interior and boundary of the primary (geometry a)\n * must not intersect the exterior of the secondary (geometry b).\n * Boolean-within returns the exact opposite result of the `@turf/boolean-contains`.\n *\n * @name booleanWithin\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 line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);\n * var point = turf.point([1, 2]);\n *\n * turf.booleanWithin(point, line);\n * //=true\n */\nfunction booleanWithin(\n feature1: Feature<any> | Geometry,\n feature2: Feature<any> | Geometry\n): boolean {\n var geom1 = getGeom(feature1);\n var geom2 = getGeom(feature2);\n var type1 = geom1.type;\n var type2 = geom2.type;\n\n switch (type1) {\n case \"Point\":\n switch (type2) {\n case \"MultiPoint\":\n return isPointInMultiPoint(geom1, geom2);\n case \"LineString\":\n return booleanPointOnLine(geom1, geom2, { ignoreEndVertices: true });\n case \"Polygon\":\n case \"MultiPolygon\":\n return booleanPointInPolygon(geom1, geom2, { ignoreBoundary: true });\n default:\n throw new Error(\"feature2 \" + type2 + \" geometry not supported\");\n }\n case \"MultiPoint\":\n switch (type2) {\n case \"MultiPoint\":\n return isMultiPointInMultiPoint(geom1, geom2);\n case \"LineString\":\n return isMultiPointOnLine(geom1, geom2);\n case \"Polygon\":\n case \"MultiPolygon\":\n return isMultiPointInPoly(geom1, geom2);\n default:\n throw new Error(\"feature2 \" + type2 + \" geometry not supported\");\n }\n case \"LineString\":\n switch (type2) {\n case \"LineString\":\n return isLineOnLine(geom1, geom2);\n case \"Polygon\":\n case \"MultiPolygon\":\n return isLineInPoly(geom1, geom2);\n default:\n throw new Error(\"feature2 \" + type2 + \" geometry not supported\");\n }\n case \"Polygon\":\n switch (type2) {\n case \"Polygon\":\n case \"MultiPolygon\":\n return isPolyInPoly(geom1, geom2);\n default:\n throw new Error(\"feature2 \" + type2 + \" geometry not supported\");\n }\n default:\n throw new Error(\"feature1 \" + type1 + \" geometry not supported\");\n }\n}\n\nfunction isPointInMultiPoint(point: Point, multiPoint: MultiPoint) {\n var i;\n var output = false;\n for (i = 0; i < multiPoint.coordinates.length; i++) {\n if (compareCoords(multiPoint.coordinates[i], point.coordinates)) {\n output = true;\n break;\n }\n }\n return output;\n}\n\nfunction isMultiPointInMultiPoint(\n multiPoint1: MultiPoint,\n multiPoint2: MultiPoint\n) {\n for (var i = 0; i < multiPoint1.coordinates.length; i++) {\n var anyMatch = false;\n for (var i2 = 0; i2 < multiPoint2.coordinates.length; i2++) {\n if (\n compareCoords(multiPoint1.coordinates[i], multiPoint2.coordinates[i2])\n ) {\n anyMatch = true;\n }\n }\n if (!anyMatch) {\n return false;\n }\n }\n return true;\n}\n\nfunction isMultiPointOnLine(multiPoint: MultiPoint, lineString: LineString) {\n var foundInsidePoint = false;\n\n for (var i = 0; i < multiPoint.coordinates.length; i++) {\n if (!booleanPointOnLine(multiPoint.coordinates[i], lineString)) {\n return false;\n }\n if (!foundInsidePoint) {\n foundInsidePoint = booleanPointOnLine(\n multiPoint.coordinates[i],\n lineString,\n { ignoreEndVertices: true }\n );\n }\n }\n return foundInsidePoint;\n}\n\nfunction isMultiPointInPoly(multiPoint: MultiPoint, polygon: Polygon) {\n var output = true;\n var oneInside = false;\n var isInside = false;\n for (var i = 0; i < multiPoint.coordinates.length; i++) {\n isInside = booleanPointInPolygon(multiPoint.coordinates[i], polygon);\n if (!isInside) {\n output = false;\n break;\n }\n if (!oneInside) {\n isInside = booleanPointInPolygon(multiPoint.coordinates[i], polygon, {\n ignoreBoundary: true,\n });\n }\n }\n return output && isInside;\n}\n\nfunction isLineOnLine(lineString1: LineString, lineString2: LineString) {\n for (var i = 0; i < lineString1.coordinates.length; i++) {\n if (!booleanPointOnLine(lineString1.coordinates[i], lineString2)) {\n return false;\n }\n }\n return true;\n}\n\nfunction isLineInPoly(linestring: LineString, polygon: Polygon) {\n var polyBbox = calcBbox(polygon);\n var lineBbox = calcBbox(linestring);\n if (!doBBoxOverlap(polyBbox, lineBbox)) {\n return false;\n }\n var foundInsidePoint = false;\n\n for (var i = 0; i < linestring.coordinates.length; i++) {\n if (!booleanPointInPolygon(linestring.coordinates[i], polygon)) {\n return false;\n }\n if (!foundInsidePoint) {\n foundInsidePoint = booleanPointInPolygon(\n linestring.coordinates[i],\n polygon,\n { ignoreBoundary: true }\n );\n }\n if (!foundInsidePoint && i < linestring.coordinates.length - 1) {\n var midpoint = getMidpoint(\n linestring.coordinates[i],\n linestring.coordinates[i + 1]\n );\n foundInsidePoint = booleanPointInPolygon(midpoint, polygon, {\n ignoreBoundary: true,\n });\n }\n }\n return foundInsidePoint;\n}\n\n/**\n * Is Polygon2 in Polygon1\n * Only takes into account outer rings\n *\n * @private\n * @param {Polygon} geometry1\n * @param {Polygon|MultiPolygon} geometry2\n * @returns {boolean} true/false\n */\nfunction isPolyInPoly(geometry1: Polygon, geometry2: Polygon | MultiPolygon) {\n var poly1Bbox = calcBbox(geometry1);\n var poly2Bbox = calcBbox(geometry2);\n if (!doBBoxOverlap(poly2Bbox, poly1Bbox)) {\n return false;\n }\n for (var i = 0; i < geometry1.coordinates[0].length; i++) {\n if (!booleanPointInPolygon(geometry1.coordinates[0][i], geometry2)) {\n return false;\n }\n }\n return true;\n}\n\nfunction doBBoxOverlap(bbox1: BBox, bbox2: BBox) {\n if (bbox1[0] > bbox2[0]) return false;\n if (bbox1[2] < bbox2[2]) return false;\n if (bbox1[1] > bbox2[1]) return false;\n if (bbox1[3] < bbox2[3]) return false;\n return true;\n}\n\n/**\n * compareCoords\n *\n * @private\n * @param {Position} pair1 point [x,y]\n * @param {Position} pair2 point [x,y]\n * @returns {boolean} true/false if coord pairs match\n */\nfunction compareCoords(pair1: number[], pair2: number[]) {\n return pair1[0] === pair2[0] && pair1[1] === pair2[1];\n}\n\n/**\n * getMidpoint\n *\n * @private\n * @param {Position} pair1 point [x,y]\n * @param {Position} pair2 point [x,y]\n * @returns {Position} midpoint of pair1 and pair2\n */\nfunction getMidpoint(pair1: number[], pair2: number[]) {\n return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];\n}\n\nexport { booleanWithin };\nexport default booleanWithin;\n"],"mappings":";AAUA,SAAS,QAAQ,gBAAgB;AACjC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,eAAe;AAmBxB,SAAS,cACP,UACA,UACS;AACT,MAAI,QAAQ,QAAQ,QAAQ;AAC5B,MAAI,QAAQ,QAAQ,QAAQ;AAC5B,MAAI,QAAQ,MAAM;AAClB,MAAI,QAAQ,MAAM;AAElB,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,cAAQ,OAAO;AAAA,QACb,KAAK;AACH,iBAAO,oBAAoB,OAAO,KAAK;AAAA,QACzC,KAAK;AACH,iBAAO,mBAAmB,OAAO,OAAO,EAAE,mBAAmB,KAAK,CAAC;AAAA,QACrE,KAAK;AAAA,QACL,KAAK;AACH,iBAAO,sBAAsB,OAAO,OAAO,EAAE,gBAAgB,KAAK,CAAC;AAAA,QACrE;AACE,gBAAM,IAAI,MAAM,cAAc,QAAQ,yBAAyB;AAAA,MACnE;AAAA,IACF,KAAK;AACH,cAAQ,OAAO;AAAA,QACb,KAAK;AACH,iBAAO,yBAAyB,OAAO,KAAK;AAAA,QAC9C,KAAK;AACH,iBAAO,mBAAmB,OAAO,KAAK;AAAA,QACxC,KAAK;AAAA,QACL,KAAK;AACH,iBAAO,mBAAmB,OAAO,KAAK;AAAA,QACxC;AACE,gBAAM,IAAI,MAAM,cAAc,QAAQ,yBAAyB;AAAA,MACnE;AAAA,IACF,KAAK;AACH,cAAQ,O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+
"version": "7.1.0-alpha.70+948cdafaf",
|
|
4
4
|
"description": "turf boolean-within module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -71,12 +71,13 @@
|
|
|
71
71
|
"typescript": "^5.2.2"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@turf/bbox": "^7.0.
|
|
75
|
-
"@turf/boolean-point-in-polygon": "^7.0.
|
|
76
|
-
"@turf/boolean-point-on-line": "^7.0.
|
|
77
|
-
"@turf/helpers": "^7.0.
|
|
78
|
-
"@turf/invariant": "^7.0.
|
|
74
|
+
"@turf/bbox": "^7.1.0-alpha.70+948cdafaf",
|
|
75
|
+
"@turf/boolean-point-in-polygon": "^7.1.0-alpha.70+948cdafaf",
|
|
76
|
+
"@turf/boolean-point-on-line": "^7.1.0-alpha.70+948cdafaf",
|
|
77
|
+
"@turf/helpers": "^7.1.0-alpha.70+948cdafaf",
|
|
78
|
+
"@turf/invariant": "^7.1.0-alpha.70+948cdafaf",
|
|
79
|
+
"@types/geojson": "^7946.0.10",
|
|
79
80
|
"tslib": "^2.6.2"
|
|
80
81
|
},
|
|
81
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "948cdafaf70606d2e27fcc79973fa48ee1182067"
|
|
82
83
|
}
|