turf line-intersect module
npm install @spatial/line-intersectTakes any LineString or Polygon GeoJSON and returns the intersecting point(s).
- line1 ([Geometry][1] \| [FeatureCollection][2] \| [Feature][3]<([LineString][4] \| [MultiLineString][5] \| [Polygon][6] \| [MultiPolygon][7])>) any LineString or Polygon
- line2 ([Geometry][1] \| [FeatureCollection][2] \| [Feature][3]<([LineString][4] \| [MultiLineString][5] \| [Polygon][6] \| [MultiPolygon][7])>) any LineString or Polygon
``javascript
var line1 = turf.lineString([[126, -11], [129, -21]]);
var line2 = turf.lineString([[123, -18], [131, -14]]);
var intersects = turf.lineIntersect(line1, line2);
//addToMap
var addToMap = [line1, line2, intersects]
`
Returns [FeatureCollection][2]<[Point][8]> point(s) that intersect both
[1]: https://tools.ietf.org/html/rfc7946#section-3.1
[2]: https://tools.ietf.org/html/rfc7946#section-3.3
[3]: https://tools.ietf.org/html/rfc7946#section-3.2
[4]: https://tools.ietf.org/html/rfc7946#section-3.1.4
[5]: https://tools.ietf.org/html/rfc7946#section-3.1.5
[6]: https://tools.ietf.org/html/rfc7946#section-3.1.6
[7]: https://tools.ietf.org/html/rfc7946#section-3.1.7
[8]: https://tools.ietf.org/html/rfc7946#section-3.1.2
---
This module is part of the Turfjs project, an open source
module collection dedicated to geographic algorithms. It is maintained in the
Turfjs/turf repository, where you can create
PRs and issues.
Install this module individually:
`sh`
$ npm install @spatial/line-intersect
Or install the Turf module that includes it as a function:
`sh``
$ npm install @turf/turf