Skip to content

@turf/clusters-dbscan: Fix clustersDbscan not respecting units option#3026

Open
mradlinski wants to merge 1 commit into
Turfjs:masterfrom
mradlinski:fix/dbscan-units
Open

@turf/clusters-dbscan: Fix clustersDbscan not respecting units option#3026
mradlinski wants to merge 1 commit into
Turfjs:masterfrom
mradlinski:fix/dbscan-units

Conversation

@mradlinski

Copy link
Copy Markdown

Previously clustersDbscan respected the units option in regards to maxDistance.
It seems this was overlooked when switching to kdbush in 6e4c18b .

This PR fixes it by converting maxDistance from whatever unit was passed in the option to kilometers (which are used internally by kdbush).

A test was added to check if units are respected for kilometers, meters and degrees.

I didn't find an issue for this, and thought that perhaps for such a simple issue one wasn't needed before creating a PR, sorry if that's the wrong workflow in this project.

@mfedderly

Copy link
Copy Markdown
Collaborator

Thanks for the PR and pointing out where the broken behavior was introduced, it was really helpful as a jumping off poit to start looking into this. The PR itself has been reverted and released as 7.3.5. Is there any chance you have time to rebase this PR and have it just add the test case so we make sure not to break things going forward? If I misunderstood and we still need some form of fix in addition to the test, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants