Turf: clustering methods mutation option

Created on 17 Dec 2017  路  3Comments  路  Source: Turfjs/turf

Right now .clustersDbscan() returns a new collection with clones of the input with additional fields, not altering anything in the input. It would be helpful to have an option for mutating the features and getting a collection with them as the return, where both the input collection and it's members would be the same objects as input. Maybe even 2 options to mutate only members and only the collection (i.e. the collection remains the same object but is repopulated by clones... for whatever reason it may be helpful).

Also I think both clustering methods are philosophically similar to .pointsWithinPolygon(), but clusterers return clones, while the later returns the originals. Whether you choose to implement my suggestion or not, I think all these methods should be brought to common denominator, i.e. either return only clones or the originals by default.

Thank you.

easy-fix enhancement

Most helpful comment

Gday @Spown

Yeah we have started implementing mutate as an option on a number of modules, it's just a matter of time available as there are many modules to look after, feel free to put in a pull request :)

Providing both options to users (whether to mutate features in a collection or not) gives them the flexibility to choose what is appropriate to their use case.

Cheers

All 3 comments

Gday @Spown

Yeah we have started implementing mutate as an option on a number of modules, it's just a matter of time available as there are many modules to look after, feel free to put in a pull request :)

Providing both options to users (whether to mutate features in a collection or not) gives them the flexibility to choose what is appropriate to their use case.

Cheers

Agreed, actually it "shouldn't" be too difficult to add a options.mutate parameter, i'll see if I can get that implemented in a short period of time.

Going to be implemented in v5.2

Was this page helpful?
0 / 5 - 0 ratings