index.d.ts 1.3 KB

1234567891011121314151617181920212223
  1. import { FeatureCollection, Feature, LineString, MultiLineString, Polygon, MultiPolygon } from "@turf/helpers";
  2. /**
  3. * Takes any LineString or Polygon and returns the overlapping lines between both features.
  4. *
  5. * @name lineOverlap
  6. * @param {Geometry|Feature<LineString|MultiLineString|Polygon|MultiPolygon>} line1 any LineString or Polygon
  7. * @param {Geometry|Feature<LineString|MultiLineString|Polygon|MultiPolygon>} line2 any LineString or Polygon
  8. * @param {Object} [options={}] Optional parameters
  9. * @param {number} [options.tolerance=0] Tolerance distance to match overlapping line segments (in kilometers)
  10. * @returns {FeatureCollection<LineString>} lines(s) that are overlapping between both features
  11. * @example
  12. * var line1 = turf.lineString([[115, -35], [125, -30], [135, -30], [145, -35]]);
  13. * var line2 = turf.lineString([[115, -25], [125, -30], [135, -30], [145, -25]]);
  14. *
  15. * var overlapping = turf.lineOverlap(line1, line2);
  16. *
  17. * //addToMap
  18. * var addToMap = [line1, line2, overlapping]
  19. */
  20. declare function lineOverlap<G1 extends LineString | MultiLineString | Polygon | MultiPolygon, G2 extends LineString | MultiLineString | Polygon | MultiPolygon>(line1: Feature<G1> | G1, line2: Feature<G2> | G2, options?: {
  21. tolerance?: number;
  22. }): FeatureCollection<LineString>;
  23. export default lineOverlap;