index.d.ts 1.3 KB

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