jmlondon / pathroutr

R package for routing tracks around barrier polygons
https://jmlondon.github.io/pathroutr/
16 stars 2 forks source link

`prt_visgraph` argument `aug_points` doesn't work #18

Closed benjaminhlina closed 1 year ago

benjaminhlina commented 1 year ago

Hi Josh,

I have been using pathroutr for acoustic telemetry used to track fish movement. Acoustic telemetry relies on stationary receivers to listen for transmitters implanted into the fish. I have wanted to use pathroutr to calculate the shortest distances between receivers that a fish theoretical could take.

I have ran into some of my own issues with getting paths to coerce within the confinement of the lake I am working on and thought that maybe if I force the network created by prt_visgraph() to have additional nodes where the receivers are located that might alleviate the issue. However, when providing prt_visgraph()'s the argument aug_points I have found two bugs, the first is that within the prt_visgraph(), augment points is called two different things without being properly assigned see lines 86-108. Within the function it first checks to see if aug_points is a sf POINT object, it then uses aug_pts as the name of aug_points yet aug_points has not been reassigned the name aug_pts. To get this to run, I've just updated my local copy.

The second issue is that once this is corrected and I supply aug_points with a sf POINT object, you have to provide the augmented points by directly calling the geometry of the sf object, such as aug_points = df_utm$geometry. It would be nice if you could just supply the sf object without having to call the geometry directly.

Thanks and thank you for making such a great package!