turf
turf copied to clipboard
Allow aggregating properties in turf-clusters-dbscan
clustersDbscan() does not allow any way to determine which source points have been grouped in each cluster, or a way to aggregate properties in that cluster.
It would be helpful if one or both of these options were supported:
- a
clusterIdsoption, which if true would include aclusterIdsproperty, an array ofids of each feature in the cluster. - an
aggregateFuncoption, a function which would be called with a feature being clustered, and the cluster it is being grouped into.
Hello @stevage,
Looking at the documentation for clustersDbscan, it seems that the first option you suggest is already supported, by means of an additional propery named cluster.
Returns
FeatureCollection<Point, DbscanProps> Clustered Points with an additional two properties associated to each Feature:
- {number} cluster - the associated clusterId
- {string} dbscan - type of point it has been classified as ('core' | 'edge' | 'noise')