Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turf/boolean-intersects

Package Overview
Dependencies
Maintainers
9
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/boolean-intersects - npm Package Compare versions

Comparing version 7.1.0-alpha.7 to 7.1.0-alpha.70

25

dist/esm/index.d.ts
import { Feature, Geometry } from 'geojson';
/**
* Boolean-intersects returns (TRUE) two geometries intersect.
* Boolean-intersects returns (TRUE) if the intersection of the two geometries is NOT an empty set.
*

@@ -9,12 +9,25 @@ * @name booleanIntersects

* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
* @returns {boolean} true/false
* @param {Object} [options={}] Optional parameters
* @param {boolean} [options.ignoreSelfIntersections=false] ignores self-intersections on input features
* @returns {boolean} true if geometries intersect, false otherwise
* @example
* var point = turf.point([2, 2]);
* var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
* var point1 = turf.point([2, 2]);
* var point2 = turf.point([1, 2]);
* var line = turf.lineString([[1, 1], [1, 3], [1, 4]]);
*
* turf.booleanIntersects(line, point);
* turf.booleanIntersects(line, point1);
* //=false
*
* turf.booleanIntersects(line, point2);
* //=true
*
* //addToMap
* var addToMap = [point1, point2, line];
* point1.properties['marker-color'] = '#f00'
* point2.properties['marker-color'] = '#0f0'
*/
declare function booleanIntersects(feature1: Feature<any> | Geometry, feature2: Feature<any> | Geometry): boolean;
declare function booleanIntersects(feature1: Feature<any> | Geometry, feature2: Feature<any> | Geometry, options?: {
ignoreSelfIntersections?: boolean;
}): boolean;
export { booleanIntersects, booleanIntersects as default };
// index.ts
import { booleanDisjoint } from "@turf/boolean-disjoint";
import { flattenEach } from "@turf/meta";
function booleanIntersects(feature1, feature2) {
function booleanIntersects(feature1, feature2, options = {}) {
var _a;
const ignoreSelfIntersections = (_a = options.ignoreSelfIntersections) != null ? _a : false;
let bool = false;

@@ -11,3 +13,5 @@ flattenEach(feature1, (flatten1) => {

}
bool = !booleanDisjoint(flatten1.geometry, flatten2.geometry);
bool = !booleanDisjoint(flatten1.geometry, flatten2.geometry, {
ignoreSelfIntersections
});
});

@@ -14,0 +18,0 @@ });

{
"name": "@turf/boolean-intersects",
"version": "7.1.0-alpha.7+0ce6ecca0",
"version": "7.1.0-alpha.70+948cdafaf",
"description": "turf boolean-intersects module",

@@ -8,3 +8,4 @@ "author": "Turf Authors",

"Rowan Winsemius <@rowanwins>",
"Denis Carriere <@DenisCarriere>"
"Denis Carriere <@DenisCarriere>",
"David Whittingham <@01100100>"
],

@@ -71,8 +72,9 @@ "license": "MIT",

"dependencies": {
"@turf/boolean-disjoint": "^7.1.0-alpha.7+0ce6ecca0",
"@turf/helpers": "^7.1.0-alpha.7+0ce6ecca0",
"@turf/meta": "^7.1.0-alpha.7+0ce6ecca0",
"@turf/boolean-disjoint": "^7.1.0-alpha.70+948cdafaf",
"@turf/helpers": "^7.1.0-alpha.70+948cdafaf",
"@turf/meta": "^7.1.0-alpha.70+948cdafaf",
"@types/geojson": "^7946.0.10",
"tslib": "^2.6.2"
},
"gitHead": "0ce6ecca05829690270fec6d6bed2003495fe0ea"
"gitHead": "948cdafaf70606d2e27fcc79973fa48ee1182067"
}

@@ -7,3 +7,3 @@ # @turf/boolean-intersects

Boolean-intersects returns (TRUE) two geometries intersect.
Boolean-intersects returns (TRUE) if the intersection of the two geometries is NOT an empty set.

@@ -14,14 +14,26 @@ ### Parameters

* `feature2` **([Geometry][1] | [Feature][2]\<any>)** GeoJSON Feature or Geometry
* `options` **[Object][3]** Optional parameters (optional, default `{}`)
* `options.ignoreSelfIntersections` **[boolean][4]** ignores self-intersections on input features (optional, default `false`)
### Examples
```javascript
var point = turf.point([2, 2]);
var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
var point1 = turf.point([2, 2]);
var point2 = turf.point([1, 2]);
var line = turf.lineString([[1, 1], [1, 3], [1, 4]]);
turf.booleanIntersects(line, point);
turf.booleanIntersects(line, point1);
//=false
turf.booleanIntersects(line, point2);
//=true
//addToMap
var addToMap = [point1, point2, line];
point1.properties['marker-color'] = '#f00'
point2.properties['marker-color'] = '#0f0'
```
Returns **[boolean][3]** true/false
Returns **[boolean][4]** true if geometries intersect, false otherwise

@@ -32,4 +44,6 @@ [1]: https://tools.ietf.org/html/rfc7946#section-3.1

[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
<!-- 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. -->

@@ -36,0 +50,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc