index.d.cts 1.3 KB

123456789101112131415161718192021222324
  1. import { FeatureCollection, Polygon, MultiPolygon, Feature } from 'geojson';
  2. /**
  3. * Smooths a {@link Polygon} or {@link MultiPolygon}. Based on [Chaikin's algorithm](http://graphics.cs.ucdavis.edu/education/CAGDNotes/Chaikins-Algorithm/Chaikins-Algorithm.html).
  4. * Warning: may create degenerate polygons.
  5. *
  6. * @function
  7. * @param {FeatureCollection<Polygon|MultiPolygon>|Feature<Polygon|MultiPolygon>|Polygon|MultiPolygon} inputPolys (Multi)Polygon(s) to smooth
  8. * @param {Object} [options={}] Optional parameters
  9. * @param {string} [options.iterations=1] The number of times to smooth the polygon. A higher value means a smoother polygon.
  10. * @returns {FeatureCollection<Polygon|MultiPolygon>} FeatureCollection containing the smoothed polygon/multipoylgons
  11. * @example
  12. * var polygon = turf.polygon([[[11, 0], [22, 4], [31, 0], [31, 11], [21, 15], [11, 11], [11, 0]]]);
  13. *
  14. * var smoothed = turf.polygonSmooth(polygon, {iterations: 3})
  15. *
  16. * //addToMap
  17. * var addToMap = [smoothed, polygon];
  18. */
  19. declare function polygonSmooth(inputPolys: FeatureCollection<Polygon | MultiPolygon> | Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon, options?: {
  20. iterations?: number;
  21. }): FeatureCollection<Polygon | MultiPolygon>;
  22. export { polygonSmooth as default, polygonSmooth };