Chris
Chris

Reputation: 2800

Spatial clustering with ruby and mongodb

I'm using mongodb geospatial indexing to get a list of objects located within a rectangle. It works fine but now I would like to get clusters of near objects.

The way I implemented it is n^2 complex: for each event returned by mongo, compare it with previous events and merge them if they are near enough from each other.

Does anyone have something more performant?

Thank you, Christian

Upvotes: 0

Views: 630

Answers (1)

Derick
Derick

Reputation: 36784

http://osl.iu.edu/~chemuell/projects/presentations/optics-v1.pdf has an good description and a pseudo implementation at least. Directly doing this in MongoDB will probably not be a good idea (or not even possible).

Upvotes: 2

Related Questions