Given some location of interest $X$ in a lake or in the ocean with known lat and lon, I'd like to find the lat and lon of the coastal location that is closest to $X$, as well as distance between the two points. Of course, once the lat and lon of the coastal point is found, it's straightforward to compute the distance. I know of this DistFromCoast dataset that has the distance to the nearest coastal point, but it does not provide the nearest coastal point itself.
Would anyone know of datasets, software, or algorithms that may help with my task?