index.d.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { Coord, Units } from '@turf/helpers';
  2. import { GeoJsonProperties, Feature, Polygon } from 'geojson';
  3. /**
  4. * Takes a {@link Point} and calculates the ellipse polygon given two semi-axes expressed in variable units and steps for precision.
  5. *
  6. * @param {Coord} center center point
  7. * @param {number} xSemiAxis semi (major) axis of the ellipse along the x-axis
  8. * @param {number} ySemiAxis semi (minor) axis of the ellipse along the y-axis
  9. * @param {Object} [options={}] Optional parameters
  10. * @param {number} [options.angle=0] angle of rotation in decimal degrees, positive clockwise
  11. * @param {Coord} [options.pivot=center] point around which any rotation will be performed
  12. * @param {number} [options.steps=64] number of steps
  13. * @param {string} [options.units='kilometers'] unit of measurement for axes
  14. * @param {Object} [options.properties={}] properties
  15. * @returns {Feature<Polygon>} ellipse polygon
  16. * @example
  17. * var center = [-75, 40];
  18. * var xSemiAxis = 5;
  19. * var ySemiAxis = 2;
  20. * var ellipse = turf.ellipse(center, xSemiAxis, ySemiAxis);
  21. *
  22. * //addToMap
  23. * var addToMap = [turf.point(center), ellipse]
  24. */
  25. declare function ellipse(center: Coord, xSemiAxis: number, ySemiAxis: number, options: {
  26. steps?: number;
  27. units?: Units;
  28. angle?: number;
  29. pivot?: Coord;
  30. properties?: GeoJsonProperties;
  31. }): Feature<Polygon>;
  32. export { ellipse as default, ellipse };