index.d.ts 1.5 KB

12345678910111213141516171819202122232425262728293031
  1. import { GeoJSON, GeometryCollection } from 'geojson';
  2. import { Units } from '@turf/helpers';
  3. /**
  4. * Moves any geojson Feature or Geometry of a specified distance along a Rhumb Line
  5. * on the provided direction angle.
  6. *
  7. * @function
  8. * @param {GeoJSON|GeometryCollection} geojson object to be translated
  9. * @param {number} distance length of the motion; negative values determine motion in opposite direction
  10. * @param {number} direction of the motion; angle from North in decimal degrees, positive clockwise
  11. * @param {Object} [options={}] Optional parameters
  12. * @param {Units} [options.units='kilometers'] in which `distance` will be express; miles, kilometers, degrees, or radians
  13. * @param {number} [options.zTranslation=0] length of the vertical motion, same unit of distance
  14. * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
  15. * @returns {GeoJSON|GeometryCollection} the translated GeoJSON object
  16. * @example
  17. * var poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);
  18. * var translatedPoly = turf.transformTranslate(poly, 100, 35);
  19. *
  20. * //addToMap
  21. * var addToMap = [poly, translatedPoly];
  22. * translatedPoly.properties = {stroke: '#F00', 'stroke-width': 4};
  23. */
  24. declare function transformTranslate<T extends GeoJSON | GeometryCollection>(geojson: T, distance: number, direction: number, options?: {
  25. units?: Units;
  26. zTranslation?: number;
  27. mutate?: boolean;
  28. }): T;
  29. export { transformTranslate as default, transformTranslate };