I am searching for a method for clustering spatial points along spatial lines. The points are connected to the lines.

I tried nearest neighbour clustering and gProject/gInterpolate from the rgeos package. As you can see in the image, both results have the same problem: the clustering along lines doesn't make sense. In the image below, the point colours visualize the different clusters.

false clustering along line

Is there a solution in R or in QGIS to cluster the points by their location on a line/network?

  • Compute the distance between all pairs of points along the line network and feed that distance matrix into a clustering algorithm. How to compute distances along line networks is a separate question which may already have been answered. – Spacedman Apr 23 '18 at 14:05

Your Answer

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

Browse other questions tagged or ask your own question.