0
$\begingroup$

I am trying to process a large set of location data where a list of start and end coordinate is given. For example,

[
  [(start_lat1, start_lon1), (end_lat1, end_lon1)],
  [(start_lat2, start_lon2), (end_lat2, end_lon2)],
  [(start_lat3, start_lon3), (end_lat3, end_lon3)],
  [(start_lat4, start_lon4), (end_lat4, end_lon4)],
  [(start_lat5, start_lon5), (end_lat5, end_lon5)],
  ...
]

My goal is to create clusters so that if different pair of start and end locations are close, they will form a cluster of pair with those start and end locations. For example, the average for the clustered pair will look something like this,

[
  [(start_lat_C1, start_lon_C1), (end_lat_C1, end_lon_C1)],
  [(start_lat_C2, start_lon_C2), (end_lat_C2, end_lon_C2)
  ...
]

I was following https://geoffboeing.com/2014/08/clustering-to-reduce-spatial-data-set-size/ this, but the tutorial only works for a single coordinate point. Any help about how to approach for paired clustering would be much appreciated.

$\endgroup$
2
  • $\begingroup$ The increase in coordinates will only lead to an increase in a dimension. The data becomes two dimensional. This will not affect the algorithm as the Euclidean distance formula is regardless of the dimensions. It works on multidimensional data as well. $\endgroup$ Commented May 17, 2019 at 1:44
  • $\begingroup$ @ShubhamPanchal ... Except that using Euclidean distance on Latitude Longitude is a bad idea. $\endgroup$ Commented May 19, 2019 at 7:43

1 Answer 1

1
$\begingroup$

Define your own distance function.

I suggest you simply use

dist(x,y)=haversine(x[0],y[0])+haversine(x[1],y[1])
$\endgroup$
1
  • $\begingroup$ Thanks for the answer. Although I solved the problem using another approach, I will definitely try your suggestion. $\endgroup$
    – Irteza
    Commented May 21, 2019 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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