noaa-nwfsc / FishSET

FishSET (fisheries spatial economics toolbox) includes tools for spatial data analysis, running location choice models, and simulating policy scenarios.
https://noaa-nwfsc.github.io/FishSET/
Other
4 stars 1 forks source link

circumvent-land-for-travel-distance #162

Open Paul-Carvalho opened 3 months ago

Paul-Carvalho commented 3 months ago

Currently don't account for land in the patch of travel distance, but we should account for this and calculate distance when circumventing land in distance.

mle2718 commented 3 months ago

We did this a long time ago to get travel distances from port to any spot in the ocean using the gdistance package. The steps are:

  1. Convert the ocean to a grid.
  2. Assign grid cells that are on land a very high cost to travel though. You need to supply a polygon for land (or other no-go zones).
  3. Use the costdistance function to compute travel costs from port to any grid cell.
  4. Pull out the length of the shortest path.

I'm not sure if this is the best method. It requires an extra package. The algorithm also can take a while to crank through because it has to do some backward recursion.

I have some code that you could use to build off.

Paul-Carvalho commented 3 months ago

Thanks @mle2718! If you could find that code and send it over that would be great

mle2718 commented 2 months ago

email sent.