1

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?

Vince
  • 20,017
  • 15
  • 45
  • 64
yt1300
  • 39
  • 2
  • raster::gridDistance() with omit parameter – Elio Diaz Aug 17 '20 at 22:28
  • Have a read of https://gis.stackexchange.com/questions/168453/finding-least-cost-path-in-qgis within a street or watercourse network the least distance between two points without going outside is least cost path. – Michael Stimson Aug 17 '20 at 23:54

0 Answers0