index.d.cts 841 B

12345678910111213141516171819
  1. import { LineString, MultiLineString, Polygon, MultiPolygon, Feature, FeatureCollection } from 'geojson';
  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. * @function
  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 { lineSegment as default, lineSegment };