index.d.cts 1.1 KB

1234567891011121314151617181920212223
  1. import { LineString, MultiLineString, Feature, FeatureCollection, Polygon } from 'geojson';
  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. * @function
  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. declare function polygonize<T extends LineString | MultiLineString>(geoJson: Feature<T> | FeatureCollection<T> | T): FeatureCollection<Polygon>;
  21. export { polygonize as default, polygonize };