index.d.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import { BBox, FeatureCollection, LineString, Point, Polygon, Position } from "@turf/helpers";
  2. /**
  3. * Returns a random position within a {@link bounding box}.
  4. *
  5. * @name randomPosition
  6. * @param {Array<number>} [bbox=[-180, -90, 180, 90]] a bounding box inside of which positions are placed.
  7. * @returns {Array<number>} Position [longitude, latitude]
  8. * @example
  9. * var position = turf.randomPosition([-180, -90, 180, 90])
  10. * // => position
  11. */
  12. export declare function randomPosition(bbox?: BBox | {
  13. bbox: BBox;
  14. }): Position;
  15. /**
  16. * Returns a random {@link point}.
  17. *
  18. * @name randomPoint
  19. * @param {number} [count=1] how many geometries will be generated
  20. * @param {Object} [options={}] Optional parameters
  21. * @param {Array<number>} [options.bbox=[-180, -90, 180, 90]] a bounding box inside of which geometries are placed.
  22. * @returns {FeatureCollection<Point>} GeoJSON FeatureCollection of points
  23. * @example
  24. * var points = turf.randomPoint(25, {bbox: [-180, -90, 180, 90]})
  25. * // => points
  26. */
  27. export declare function randomPoint(count?: number, options?: {
  28. bbox?: BBox;
  29. }): FeatureCollection<Point, any>;
  30. /**
  31. * Returns a random {@link polygon}.
  32. *
  33. * @name randomPolygon
  34. * @param {number} [count=1] how many geometries will be generated
  35. * @param {Object} [options={}] Optional parameters
  36. * @param {Array<number>} [options.bbox=[-180, -90, 180, 90]] a bounding box inside of which geometries are placed.
  37. * @param {number} [options.num_vertices=10] is how many coordinates each LineString will contain.
  38. * @param {number} [options.max_radial_length=10] is the maximum number of decimal degrees latitude or longitude that a
  39. * vertex can reach out of the center of the Polygon.
  40. * @returns {FeatureCollection<Polygon>} GeoJSON FeatureCollection of polygons
  41. * @example
  42. * var polygons = turf.randomPolygon(25, {bbox: [-180, -90, 180, 90]})
  43. * // => polygons
  44. */
  45. export declare function randomPolygon(count?: number, options?: {
  46. bbox?: BBox;
  47. num_vertices?: number;
  48. max_radial_length?: number;
  49. }): FeatureCollection<Polygon, any>;
  50. /**
  51. * Returns a random {@link linestring}.
  52. *
  53. * @name randomLineString
  54. * @param {number} [count=1] how many geometries will be generated
  55. * @param {Object} [options={}] Optional parameters
  56. * @param {Array<number>} [options.bbox=[-180, -90, 180, 90]] a bounding box inside of which geometries are placed.
  57. * @param {number} [options.num_vertices=10] is how many coordinates each LineString will contain.
  58. * @param {number} [options.max_length=0.0001] is the maximum number of decimal degrees that a
  59. * vertex can be from its predecessor
  60. * @param {number} [options.max_rotation=Math.PI / 8] is the maximum number of radians that a
  61. * line segment can turn from the previous segment.
  62. * @returns {FeatureCollection<LineString>} GeoJSON FeatureCollection of linestrings
  63. * @example
  64. * var lineStrings = turf.randomLineString(25, {bbox: [-180, -90, 180, 90]})
  65. * // => lineStrings
  66. */
  67. export declare function randomLineString(count?: number, options?: {
  68. bbox?: BBox;
  69. num_vertices?: number;
  70. max_length?: number;
  71. max_rotation?: number;
  72. }): FeatureCollection<LineString, any>;