Unlike measuring pairwise terrestrial distances, marine distances need to account for landmasses, which cannot be crossed. Marine distances are a crucial predictor in genetics to build isolation by distance models. These measure gene frequencies variation under increasing geographic distances.
When marine distances are plotted against pairwise genetic differentation levels, a linear relationship is expected. Here we provide a straightforward R script to determine minimum marine distances.
A high-resolution polygon representing global landmasses is converted into an infinite resistance surface. Minimum distances between sites are computed with a shortest path algorithm considering the (infinite) resistance of landmasses and null resistance throughout the marine surface.
The outcome of the following code is a matrix of pairwise distances, a figure to visualize if sites are well represented in the surface area and a figure depicting an example of a minimum marine distance.
High resolution polygon depicting the surface of the world (e.g., Global Self-consistent Hierarchical High-resolution Shorelines; https://www.ngdc.noaa.gov/mgg/shorelines/gshhs.html)