Calculate distance from points to nearest coast

Hi,

I have coordiantes worldwide about reef benthic sites and I need to calculate the distances between these points and the nearest coast. I know I need the rnaturalearth package along with ggplot2, but not sure how to proceed with this whole thing.

Thanks to whoever can help me with the code

Perhaps the sf package will be valuable for calculating the distances between those two sets

Create a dataframe with your desired points as values.
Then use the functions of R to calculate the distance, below there are instructions.
https://search.r-project.org/CRAN/refmans/raster/html/pointDistance.html

If you need a practical example, you can watch:

Hope this helps.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.