I'm trying to get the shortest distance between each point in a a set of coordinates (lat/long) within a body of water. However, straight line distances don't work because the points represent the movement of an animal, and the body of water is curved. Thus, straight line distance results in impossible movements overland.
Is there anyway to get the distances within the boundaries of the polygon (shapefile)? Or is there a function that will calculate distance within a specified value of a raster (or ignoring NA) such that I can set the entire body of water to one value, the land to another, and it will calculate the distance only within the value for the water?
I have quite a few data sets that I need to do this for, so I really need a way to quickly process them automatically.
What function would work would this?
This is the same problem that was described here, but I am trying to do it in R not QGIS Calculating shortest distance between points within polygon using QGIS?