index.d.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { Properties, Units, FeatureCollection, Point } from "@turf/helpers";
  2. export declare type Dbscan = "core" | "edge" | "noise";
  3. export declare type DbscanProps = Properties & {
  4. dbscan?: Dbscan;
  5. cluster?: number;
  6. };
  7. /**
  8. * Takes a set of {@link Point|points} and partition them into clusters according to {@link DBSCAN's|https://en.wikipedia.org/wiki/DBSCAN} data clustering algorithm.
  9. *
  10. * @name clustersDbscan
  11. * @param {FeatureCollection<Point>} points to be clustered
  12. * @param {number} maxDistance Maximum Distance between any point of the cluster to generate the clusters (kilometers only)
  13. * @param {Object} [options={}] Optional parameters
  14. * @param {string} [options.units="kilometers"] in which `maxDistance` is expressed, can be degrees, radians, miles, or kilometers
  15. * @param {boolean} [options.mutate=false] Allows GeoJSON input to be mutated
  16. * @param {number} [options.minPoints=3] Minimum number of points to generate a single cluster,
  17. * points which do not meet this requirement will be classified as an 'edge' or 'noise'.
  18. * @returns {FeatureCollection<Point>} Clustered Points with an additional two properties associated to each Feature:
  19. * - {number} cluster - the associated clusterId
  20. * - {string} dbscan - type of point it has been classified as ('core'|'edge'|'noise')
  21. * @example
  22. * // create random points with random z-values in their properties
  23. * var points = turf.randomPoint(100, {bbox: [0, 30, 20, 50]});
  24. * var maxDistance = 100;
  25. * var clustered = turf.clustersDbscan(points, maxDistance);
  26. *
  27. * //addToMap
  28. * var addToMap = [clustered];
  29. */
  30. declare function clustersDbscan(points: FeatureCollection<Point>, maxDistance: number, options?: {
  31. units?: Units;
  32. minPoints?: number;
  33. mutate?: boolean;
  34. }): FeatureCollection<Point, DbscanProps>;
  35. export default clustersDbscan;