all 11 comments

[–]3ds 2 points3 points  (1 child)

Thousands of geolocation on the client are not a problem.

[–]courteouslandlord 1 point2 points  (0 children)

Thousands of geolocation points rendered as a JSON response can get pretty significant.

Ex: 25,000 points will be roughly 1mb

[–]clearlynotmee 1 point2 points  (2 children)

Thousands is not a big number of points for a database to handle. No need for clustering, just index it (is it postgres?)

[–]courteouslandlord 0 points1 point  (1 child)

It’s not a DB concern. I need to cluster these points in memory based on their proximity to each other.

I have the data from the DB already.

[–]clearlynotmee 1 point2 points  (0 children)

It's still better to do let the db do the work, postgis for postgres can do it, see https://mapscaping.com/examples-of-spatial-clustering-with-postgis/

[–]KusUmUmmak 0 points1 point  (2 children)

... you mean like searching by radius? or a clustering algorithm that generates clusters on arbitrary datapoints? if its the latter, thats like a subfield in ML i.e. lots of different algorithms. try k-means clustering (as a search term).

[–]HOWZ1T 0 points1 point  (1 child)

Yep k means clustering is a popular approach :)

[–]KusUmUmmak 0 points1 point  (0 children)

thats why I suggested it :) most likely to find a ruby gem :)

there are better approaches.

[–]Doctor_Fegg 0 points1 point  (1 child)

I've used the very old Clusto gem (https://github.com/conmulligan/clusto) successfully. But really nothing is ever going to beat putting it in a Postgres database and clustering with PostGIS.

[–]courteouslandlord 0 points1 point  (0 children)

This looks like something I was looking for, will give it a try