index.d.ts 1.1 KB

123456789101112131415161718192021222324252627
  1. import { Units, Point, Properties, Feature, Polygon } from "@turf/helpers";
  2. /**
  3. * Takes a {@link Point} and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision.
  4. *
  5. * @name circle
  6. * @param {Feature<Point>|number[]} center center point
  7. * @param {number} radius radius of the circle
  8. * @param {Object} [options={}] Optional parameters
  9. * @param {number} [options.steps=64] number of steps
  10. * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians
  11. * @param {Object} [options.properties={}] properties
  12. * @returns {Feature<Polygon>} circle polygon
  13. * @example
  14. * var center = [-75.343, 39.984];
  15. * var radius = 5;
  16. * var options = {steps: 10, units: 'kilometers', properties: {foo: 'bar'}};
  17. * var circle = turf.circle(center, radius, options);
  18. *
  19. * //addToMap
  20. * var addToMap = [turf.point(center), circle]
  21. */
  22. declare function circle<P = Properties>(center: number[] | Point | Feature<Point, P>, radius: number, options?: {
  23. steps?: number;
  24. units?: Units;
  25. properties?: P;
  26. }): Feature<Polygon, P>;
  27. export default circle;