Weighted clustering of lat lon coordinates I have millions of lat long points that have been grouped into squares. Some squares have thousands of points, others have a couple of points. The idea is that we have one set of lat long for the square with a weighting related to the square based on number of items it has instead of having millions of rows of data to cluster.

I was originally using the leadercluster algorithim which allowed me to specify the distance each of my clusters should cover. This is ideal for my use case but now i would like to use it to cluster squares factoring in the weight of the squares. This is basically a learning experience for me and any help would be greatly appreciated

I have seen this which could be useful but I'm not really able to make headway with it

Below is some sample data in R about airports and arrivals

df &lt;- read.csv('https://raw.githubusercontent.com/plotly/datasets/master/2011_february_us_airport_traffic.csv')

ggplot(df, aes(x = long, y = lat)) +
  geom_point()

sample &lt;- df %&gt;% 
  select(long, lat, arrivals = cnt)
Leader clustering is so simple, the weight does not make a difference.

It assigns points to a cluster if the distance is less than a threshold. It does not matter whether the point has 1 weight or is a "square" of 100.