Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3362 - Add function for DBSCAN clustering algorithm #86

Closed
wants to merge 5 commits into from

Conversation

dbaston
Copy link
Member

@dbaston dbaston commented Jan 21, 2016

This PR reworks the liblwgeom internals of ST_ClusterWithin and ST_ClusterIntersecting to make them a bit simpler and more similar, then replaces ST_ClusterWithin with DBSCAN, of which ST_ClusterWithin is a special case.

I haven't done much testing on this yet, although it passes the existing test suite and produces results equivalent to the R 'dbscan' package in the cases I've tried.

This also extends (again) the aggregation machinery in lwgeom_accum.c, since we now need to pass two constant arguments to the finalizer function instead of just one. If we decide to go the windowing route for 2.3, this stuff should be backed out.

@@ -3765,6 +3777,13 @@ CREATE AGGREGATE ST_ClusterWithin (geometry, float8) (
FINALFUNC = pgis_geometry_clusterwithin_finalfn
);

-- Availability: 2.3
CREATE AGGREGATE ST_DBSCAN (geometry, float8, int) (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've established a pattern of ST_Cluster* as the naming convention, would be good to keep?

@dbaston
Copy link
Member Author

dbaston commented Feb 24, 2016

Merged at r14674

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants