I have a dataframe with a list of coordinates (lat, long) as below:
point lat long
1 51 31
2 52 31
3 52 30
4 56 28
5 57 29
6 53 32
7 54 35
8 52 32
9 48 30
10 49 27
I already managed to generate the Delaunay triangulation using the code below:
library(deldir)
vtess <- deldir(df$lat, df$long)
plot(vtess, wlines="triang", wpoints="none", number=FALSE, add=TRUE, lty=1)
What I would like to do now is to generate an adjacency matrix (10 by 10 matrix) having the following cell values:
- If the two nodes are NOT linked by an edge in the Delaunay triangulation: Value of the cell = 0
- If the two nodes are linked by an edge in the Delaunay triangulation: Value of the cell = Geographic distance between the two nodes (using distm() from 'geosphere' package with DistVincenty option)