Python calculate lots of distances quickly

后端 未结 4 1153
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-06 08:02

I have an input of 36,742 points which means if I wanted to calculate the lower triangle of a distance matrix (using the vincenty approximation) I would need to generate 36,742*

4条回答
  •  醉酒成梦
    2021-02-06 08:42

    "Use some kind of hashing to get a quick rough-cut off (all stores within 100km) and then only calculate accurate distances between those stores" I think this might be better called gridding. So first make a dict, with a set of coords as the key and put each shop in a 50km bucket near that point. then when you are calculating distances, you only look in nearby buckets, rather than iterate through each shop in the whole universe

提交回复
热议问题