index.d.ts 1.0 KB

1234567891011121314151617181920212223
  1. import { Coord, Feature, LineString } from "@turf/helpers";
  2. /**
  3. * Returns true if a point is on a line. Accepts a optional parameter to ignore the
  4. * start and end vertices of the linestring.
  5. *
  6. * @name booleanPointOnLine
  7. * @param {Coord} pt GeoJSON Point
  8. * @param {Feature<LineString>} line GeoJSON LineString
  9. * @param {Object} [options={}] Optional parameters
  10. * @param {boolean} [options.ignoreEndVertices=false] whether to ignore the start and end vertices.
  11. * @param {number} [options.epsilon] Fractional number to compare with the cross product result. Useful for dealing with floating points such as lng/lat points
  12. * @returns {boolean} true/false
  13. * @example
  14. * var pt = turf.point([0, 0]);
  15. * var line = turf.lineString([[-1, -1],[1, 1],[1.5, 2.2]]);
  16. * var isPointOnLine = turf.booleanPointOnLine(pt, line);
  17. * //=true
  18. */
  19. declare function booleanPointOnLine(pt: Coord, line: Feature<LineString> | LineString, options?: {
  20. ignoreEndVertices?: boolean;
  21. epsilon?: number;
  22. }): boolean;
  23. export default booleanPointOnLine;