index.d.ts 833 B

1234567891011121314151617
  1. import { Feature, FeatureCollection, LineString, MultiLineString, MultiPolygon, Polygon } from "@turf/helpers";
  2. /**
  3. * Creates a {@link FeatureCollection} of 2-vertex {@link LineString} segments from a
  4. * {@link LineString|(Multi)LineString} or {@link Polygon|(Multi)Polygon}.
  5. *
  6. * @name lineSegment
  7. * @param {GeoJSON} geojson GeoJSON Polygon or LineString
  8. * @returns {FeatureCollection<LineString>} 2-vertex line segments
  9. * @example
  10. * var polygon = turf.polygon([[[-50, 5], [-40, -10], [-50, -10], [-40, 5], [-50, 5]]]);
  11. * var segments = turf.lineSegment(polygon);
  12. *
  13. * //addToMap
  14. * var addToMap = [polygon, segments]
  15. */
  16. declare function lineSegment<G extends LineString | MultiLineString | Polygon | MultiPolygon>(geojson: Feature<G> | FeatureCollection<G> | G): FeatureCollection<LineString>;
  17. export default lineSegment;