I have 2 lists composed of 100's of GPS coordinates each.
For each element is list1
, I want to find the element in list2
it is closest to. To do this, I want to use havesine and python.
from haversine import haversine
list1=[45.7, 4.8,45.6,4.8]
list2=[48.8, 2.3,48.8,2.4]
haversine(list1[0:2],list2[0:2])
I was thinking of looping through it twice, first through list1, and then again through list2, to compare every single point. I think that is too hard and slow. Is there a way to compute this faster.
A look around SO, I found Haversine Formula in Python (Bearing and Distance between two GPS points), but it does not address many to many comparisons