For a genetic analysis of Australian humpback dolphins I am currently trying to assess whether or not genetic differentiation correlates with geographic distance in water. For this I have done the following:
- Get bathymetric data using the R package
marmap
getNOAA.bathy(lon1 = 145, lon2=154, lat1 = -28, lat2 = -17, resolution = 1)
Convert it to a raster and subsequently to a transition matrix with low cost for moving in water and prohibitively high cost for traversing land
Get the shortest distance in water between each pair of points using
gdistance::shortestPath
, and converting this into a distance matrix
I am now faced with the following: The lengths I am getting from shortestPath
are in the same dimension as the coordinate system I am using, which is decimal degrees. So my question is: What is the proper way to convert this distance matrix into km?
I understand these degrees must be projected somehow but I am currently failing at figuring out how exactly I can do this.
my centroids are:
data.frame(lon = c(146.1333, 146.8698, 148.7083, 150.8709, 151.3147, 152.9791, 153.0279, 153.1816), lat = c(-18.33419, -19.22425, -20.55407, -23.43784, -23.84044, -25.26728, -25.81851, -27.35664))
and the corresponding distance matrix is:
1.3629804
3.9769987 2.7628686
7.7416532 6.5480830 4.0348631
8.1950482 6.9809181 4.4882582 0.8048330
10.4037986 9.1896685 6.6970086 3.0371065 2.3537371
10.9785875 9.7644574 7.2650158 3.6118972 2.9285279 0.6491764
12.7441285 11.5573399 9.0441220 5.3774364 4.7008506 2.4420589 1.7487997