index.d.cts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { GeoJsonProperties, Feature, Polygon } from 'geojson';
  2. import { AllGeoJSON } from '@turf/helpers';
  3. /**
  4. * Takes a {@link Feature} or a {@link FeatureCollection} and returns a convex hull {@link Polygon}.
  5. *
  6. * Internally this uses
  7. * the [convex-hull](https://github.com/mikolalysenko/convex-hull) module that implements a
  8. * [monotone chain hull](http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain).
  9. *
  10. * @function
  11. * @param {GeoJSON} geojson input Feature or FeatureCollection
  12. * @param {Object} [options={}] Optional parameters
  13. * @param {number} [options.concavity=Infinity] 1 - thin shape. Infinity - convex hull.
  14. * @param {Object} [options.properties={}] Translate Properties to Feature
  15. * @returns {Feature<Polygon>} a convex hull
  16. * @example
  17. * var points = turf.featureCollection([
  18. * turf.point([10.195312, 43.755225]),
  19. * turf.point([10.404052, 43.8424511]),
  20. * turf.point([10.579833, 43.659924]),
  21. * turf.point([10.360107, 43.516688]),
  22. * turf.point([10.14038, 43.588348]),
  23. * turf.point([10.195312, 43.755225])
  24. * ]);
  25. *
  26. * var hull = turf.convex(points);
  27. *
  28. * //addToMap
  29. * var addToMap = [points, hull]
  30. */
  31. declare function convex<P extends GeoJsonProperties = GeoJsonProperties>(geojson: AllGeoJSON, options?: {
  32. concavity?: number;
  33. properties?: P;
  34. }): Feature<Polygon, P> | null;
  35. export { convex, convex as default };