index.d.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { Feature, Polygon } from 'geojson';
  2. import { Coord } from '@turf/helpers';
  3. /**
  4. * Takes a triangular plane as a polygon and a point within that triangle, and
  5. * returns the z-value at that point.
  6. *
  7. * The Polygon should have properties `a`, `b`, and `c`
  8. * that define the values at its three corners. Alternatively, the z-values
  9. * of each triangle point can be provided by their respective 3rd coordinate
  10. * if their values are not provided as properties.
  11. *
  12. * @function
  13. * @param {Coord} point the Point for which a z-value will be calculated
  14. * @param {Feature<Polygon>} triangle a Polygon feature with three vertices
  15. * @returns {number} the z-value for `interpolatedPoint`
  16. * @example
  17. * const point = turf.point([-75.3221, 39.529]);
  18. * // "a", "b", and "c" values represent the values of the coordinates in order.
  19. * const triangle = turf.polygon([[
  20. * [-75.1221, 39.57],
  21. * [-75.58, 39.18],
  22. * [-75.97, 39.86],
  23. * [-75.1221, 39.57]
  24. * ]], {
  25. * "a": 11,
  26. * "b": 122,
  27. * "c": 44
  28. * });
  29. *
  30. * const zValue = turf.planepoint(point, triangle);
  31. * point.properties.zValue = zValue;
  32. *
  33. * //addToMap
  34. * const addToMap = [triangle, point];
  35. */
  36. declare function planepoint(point: Coord, triangle: Feature<Polygon> | Polygon): number;
  37. export { planepoint as default, planepoint };