index.d.ts 964 B

1234567891011121314151617181920212223242526
  1. import { Coord } from "@turf/helpers";
  2. /**
  3. * Takes two {@link Point|points} and finds the geographic bearing between them,
  4. * i.e. the angle measured in degrees from the north line (0 degrees)
  5. *
  6. * @name bearing
  7. * @param {Coord} start starting Point
  8. * @param {Coord} end ending Point
  9. * @param {Object} [options={}] Optional parameters
  10. * @param {boolean} [options.final=false] calculates the final bearing if true
  11. * @returns {number} bearing in decimal degrees, between -180 and 180 degrees (positive clockwise)
  12. * @example
  13. * var point1 = turf.point([-75.343, 39.984]);
  14. * var point2 = turf.point([-75.534, 39.123]);
  15. *
  16. * var bearing = turf.bearing(point1, point2);
  17. *
  18. * //addToMap
  19. * var addToMap = [point1, point2]
  20. * point1.properties['marker-color'] = '#f00'
  21. * point2.properties['marker-color'] = '#0f0'
  22. * point1.properties.bearing = bearing
  23. */
  24. export default function bearing(start: Coord, end: Coord, options?: {
  25. final?: boolean;
  26. }): number;