index.d.ts 1.4 KB

123456789101112131415161718192021222324252627
  1. import { Feature, FeatureCollection, MultiLineString, LineString, Properties } from "@turf/helpers";
  2. /**
  3. * Converts (Multi)LineString(s) to Polygon(s).
  4. *
  5. * @name lineToPolygon
  6. * @param {FeatureCollection|Feature<LineString|MultiLineString>} lines Features to convert
  7. * @param {Object} [options={}] Optional parameters
  8. * @param {Object} [options.properties={}] translates GeoJSON properties to Feature
  9. * @param {boolean} [options.autoComplete=true] auto complete linestrings (matches first & last coordinates)
  10. * @param {boolean} [options.orderCoords=true] sorts linestrings to place outer ring at the first position of the coordinates
  11. * @param {boolean} [options.mutate=false] mutate the original linestring using autoComplete (matches first & last coordinates)
  12. * @returns {Feature<Polygon|MultiPolygon>} converted to Polygons
  13. * @example
  14. * var line = turf.lineString([[125, -30], [145, -30], [145, -20], [125, -20], [125, -30]]);
  15. *
  16. * var polygon = turf.lineToPolygon(line);
  17. *
  18. * //addToMap
  19. * var addToMap = [polygon];
  20. */
  21. declare function lineToPolygon<G extends LineString | MultiLineString>(lines: Feature<G> | FeatureCollection<G> | G, options?: {
  22. properties?: Properties;
  23. autoComplete?: boolean;
  24. orderCoords?: boolean;
  25. mutate?: boolean;
  26. }): Feature<import("@turf/helpers").MultiPolygon, Properties> | Feature<import("@turf/helpers").Polygon, Properties>;
  27. export default lineToPolygon;