index.d.ts 1.0 KB

1234567891011121314151617181920212223242526
  1. import { Geometry, Feature, FeatureCollection } from 'geojson';
  2. import { AllGeoJSON } from '@turf/helpers';
  3. /**
  4. * Rewind {@link LineString|(Multi)LineString} or {@link Polygon|(Multi)Polygon} outer ring counterclockwise and inner rings clockwise (Uses {@link http://en.wikipedia.org/wiki/Shoelace_formula|Shoelace Formula}).
  5. *
  6. * @function
  7. * @param {GeoJSON} geojson input GeoJSON Polygon
  8. * @param {Object} [options={}] Optional parameters
  9. * @param {boolean} [options.reverse=false] enable reverse winding
  10. * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
  11. * @returns {GeoJSON} rewind Polygon
  12. * @example
  13. * var polygon = turf.polygon([[[121, -29], [138, -29], [138, -18], [121, -18], [121, -29]]]);
  14. *
  15. * var rewind = turf.rewind(polygon);
  16. *
  17. * //addToMap
  18. * var addToMap = [rewind];
  19. */
  20. declare function rewind<T extends AllGeoJSON>(geojson: T, options?: {
  21. reverse?: boolean;
  22. mutate?: boolean;
  23. }): Geometry | Feature | FeatureCollection;
  24. export { rewind as default, rewind };