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 <- read.csv('https://raw.githubusercontent.com/plotly/datasets/master/2011_february_us_airport_traffic.csv')

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

sample <- df %>% 
  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.

| improve this answer | |
  • $\begingroup$ Hi @Anony-Mousse, I like the algorithm very much because it scales well. However our IT architects have reasonably told me they cannot give me a million data points every 1/4 or so for a learning experience. What they can give me is a grid of 10*10 square meters of the area I'm interested in tell me how many points are contained within each of those squares. This will reduce the data by almost a factor of 20. I want to cluster these squares instead where the weighting will be attached to the number of items contained within a square........ $\endgroup$ – John Smith Sep 19 '17 at 7:50
  • $\begingroup$ ......The square itself will have a centroid of a single lat-lon coordinate. In the example above i have approximated the problem by using an airport dataset where each airport has a number of arrivals. The more arrivals in that airport, the higher the pulling power of that airport/square $\endgroup$ – John Smith Sep 19 '17 at 7:52
  • $\begingroup$ Well, you can't use Leader well on a grid map. Because Leader only uses distance (not weight), and you only have weight information. What you should probably do instead is find local maxima. $\endgroup$ – Has QUIT--Anony-Mousse Sep 19 '17 at 18:49
  • $\begingroup$ Scalability is also a pretty bad reason to like an algorithm. Random partitions scale even better. $\endgroup$ – Has QUIT--Anony-Mousse Sep 19 '17 at 18:49
  • $\begingroup$ Hi @Anony-Mousse, thank you again for the feedback. Agreed on the scalability aspect. It worked well for us but also gave good results. Could you recommend an algorithim that would be useful for my use case using weights for lat-lon. $\endgroup$ – John Smith Sep 27 '17 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.