index.d.cts 1.2 KB

12345678910111213141516171819202122232425262728
  1. import { GeoJSON, GeometryCollection } from 'geojson';
  2. import { Coord } from '@turf/helpers';
  3. /**
  4. * Rotates any geojson Feature or Geometry of a specified angle, around its `centroid` or a given `pivot` point.
  5. *
  6. * @function
  7. * @param {GeoJSON} geojson object to be rotated
  8. * @param {number} angle of rotation in decimal degrees, positive clockwise
  9. * @param {Object} [options={}] Optional parameters
  10. * @param {Coord} [options.pivot='centroid'] point around which the rotation will be performed
  11. * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
  12. * @returns {GeoJSON} the rotated GeoJSON feature
  13. * @example
  14. * const poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);
  15. * const options = {pivot: [0, 25]};
  16. * const rotatedPoly = turf.transformRotate(poly, 10, options);
  17. *
  18. * //addToMap
  19. * const addToMap = [poly, rotatedPoly];
  20. * rotatedPoly.properties = {stroke: '#F00', 'stroke-width': 4};
  21. */
  22. declare function transformRotate<T extends GeoJSON | GeometryCollection>(geojson: T, angle: number, options?: {
  23. pivot?: Coord;
  24. mutate?: boolean;
  25. }): T;
  26. export { transformRotate as default, transformRotate };