mirror of
https://github.com/Turfjs/turf.git
synced 2025-12-08 20:26:16 +00:00
Fixing boolean-intersects docs (#2593)
* Improve boolean-intersects docs * Improving boolean-intersects docs * adding boolean-intersects to documentation.yml * moved addtomap to end and colored markers --------- Co-authored-by: James Beard <james@smallsaucepan.com>
This commit is contained in:
parent
499c8d5063
commit
1f4bef87a6
@ -64,7 +64,7 @@ Changelog is no longer maintained. See Turf Github [releases](https://github.com
|
||||
- [`@turf/polygon-smooth`](polygon-smooth) Clean up a typo (#2293)
|
||||
- [`@turf/nearest-point-on-line`](nearest-point-on-line) Clean up typescript types (#2296)
|
||||
- [`@turf/boolean-touches`](boolean-touches) Add boolean-touches to docs (#2431)
|
||||
- [`@turf/boolean-equals`](boolean-equals) Improve docs (#2412)
|
||||
- [`@turf/boolean-equal`](boolean-equal) Improve docs (#2412)
|
||||
|
||||
- Remove Bower references (#2146)
|
||||
- Fix typo in README (#2313)
|
||||
|
||||
@ -139,6 +139,7 @@ toc:
|
||||
- booleanCrosses
|
||||
- booleanDisjoint
|
||||
- booleanEqual
|
||||
- booleanIntersects
|
||||
- booleanOverlap
|
||||
- booleanParallel
|
||||
- booleanPointInPolygon
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
## booleanIntersects
|
||||
|
||||
Boolean-intersects returns (TRUE) two geometries intersect.
|
||||
Boolean-intersects returns (TRUE) if the intersection of the two geometries is NOT an empty set.
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -14,11 +14,20 @@ Boolean-intersects returns (TRUE) two geometries intersect.
|
||||
### 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
|
||||
|
||||
@ -3,18 +3,27 @@ import { booleanDisjoint } from "@turf/boolean-disjoint";
|
||||
import { flattenEach } from "@turf/meta";
|
||||
|
||||
/**
|
||||
* Boolean-intersects returns (TRUE) two geometries intersect.
|
||||
* Boolean-intersects returns (TRUE) if the intersection of the two geometries is NOT an empty set.
|
||||
*
|
||||
* @name booleanIntersects
|
||||
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
|
||||
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
|
||||
* @returns {boolean} true/false
|
||||
* @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'
|
||||
*/
|
||||
function booleanIntersects(
|
||||
feature1: Feature<any> | Geometry,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user