index.d.cts 732 B

12345678910111213141516171819
  1. import { Feature, Polygon, MultiPolygon, FeatureCollection } from 'geojson';
  2. /**
  3. * Tesselates a polygon or multipolygon into a collection of triangle polygons
  4. * using [earcut](https://github.com/mapbox/earcut).
  5. *
  6. * @function
  7. * @param {Feature<Polygon|MultiPolygon>} poly the polygon to tesselate
  8. * @returns {FeatureCollection<Polygon>} collection of polygon tesselations
  9. * @example
  10. * const poly = turf.polygon([[[11, 0], [22, 4], [31, 0], [31, 11], [21, 15], [11, 11], [11, 0]]]);
  11. * const triangles = turf.tesselate(poly);
  12. *
  13. * //addToMap
  14. * const addToMap = [poly, triangles]
  15. */
  16. declare function tesselate(poly: Feature<Polygon | MultiPolygon>): FeatureCollection<Polygon>;
  17. export { tesselate as default, tesselate };