index.d.ts 1.0 KB

1234567891011121314151617181920
  1. import { Feature, FeatureCollection, LineString, MultiLineString, Polygon } from "@turf/helpers";
  2. /**
  3. * Polygonizes {@link LineString|(Multi)LineString(s)} into {@link Polygons}.
  4. *
  5. * Implementation of GEOSPolygonize function (`geos::operation::polygonize::Polygonizer`).
  6. *
  7. * Polygonizes a set of lines that represents edges in a planar graph. Edges must be correctly
  8. * noded, i.e., they must only meet at their endpoints.
  9. *
  10. * The implementation correctly handles:
  11. *
  12. * - Dangles: edges which have one or both ends which are not incident on another edge endpoint.
  13. * - Cut Edges (bridges): edges that are connected at both ends but which do not form part of a polygon.
  14. *
  15. * @name polygonize
  16. * @param {FeatureCollection|Geometry|Feature<LineString|MultiLineString>} geoJson Lines in order to polygonize
  17. * @returns {FeatureCollection<Polygon>} Polygons created
  18. * @throws {Error} if geoJson is invalid.
  19. */
  20. export default function polygonize<T extends LineString | MultiLineString>(geoJson: Feature<T> | FeatureCollection<T> | T): FeatureCollection<Polygon>;