1

Data looks like this:

ID Lat Long Time
1  3   3    00:01
1  3   4    00:02
1  4   4    00:03
2  4   3    00:01
2  4   4    00:02
2  4   5    00:03
3  5   2    00:01
3  5   3    00:02
3  5   4    00:03
4  9   9    00:01
4  9   8    00:02
4  8   8    00:03
5  7   8    00:01
5  8   8    00:02
5  8   9    00:03

I want to measure how far the IDs are away from each other within a given radius at each given time interval. I am doing this on 1057 ID's across 16213 time intervals so efficiency is important.

It is important to measure distance between points within a radius because if the points are too far away I don't care. I am trying to measure distances between points who are relatively close. For example I don't care how far away ID 1 is from ID 5 but I care about how far ID 4 is from ID 5.

I am using R and the sp package.

4

1 回答 1

0

就我所见,会有多次重复的值。因此,我建议只计算每对坐标的距离一次(即使在 df 中重复多次)作为起点。您可以过滤数据并合并表格。(我会将其添加为评论,但我还没有足够的声誉这样做)。

第一行是:

#Creating a DF with no repeated coordinates
df2 <- df %>% group_by(Lat,Long) %>% summarise()

# Calculating Distances
Dist <- distm(cbind(df2$Long,df2$Lat))
于 2018-06-15T17:24:27.470 回答