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?

  • 5
    $\begingroup$ Maybe it would be better to ask this on GIS.SE? $\endgroup$
    – Gimelist
    Commented Nov 13, 2015 at 10:31
  • 1
    $\begingroup$ My colleagues made such a dataset but it's still experimental and I don't think it's open quite yet. $\endgroup$
    – gerrit
    Commented Nov 13, 2015 at 11:21
  • 3
    $\begingroup$ @Michael Maybe, or on opendata. Personally I think it's on-topic here as well. $\endgroup$
    – gerrit
    Commented Nov 13, 2015 at 11:22
  • 4
    $\begingroup$ What kind of technology are you using or have knowledge of — a GIS, GDAL, Python...? Knowing this might help someone give you a useful answer. $\endgroup$
    – Matt Hall
    Commented Nov 13, 2015 at 17:30
  • 2
    $\begingroup$ This will be of use: gis.stackexchange.com/questions/99755/… $\endgroup$
    – f.thorpe
    Commented Nov 13, 2015 at 19:54

2 Answers 2


There are public databases with the coastline in lon,lat format. You just need to find the point closest to your coordinates in that coastline. For that you need the formula of the distance between two lon,lat points on an ellipsoid. In this article you can find that and an idea of how to do it: Garcia-Castellanos, D., & U. Lombardo, 2007. Poles of Inaccessibility: a calculation algorithm for the remotest places on Earth. Scott. Geogr. J., 123, 227-233. doi:10.1080/14702540801897809 available here: https://web.archive.org/web/20140629230429/http://cuba.ija.csic.es/~danielgc/papers/Garcia-Castellanos,%20Lombardo,%202007,%20SGJ.pdf


Well if you can describe the lake perimeter by a set of latitudes and longitudes then you can calculate the great circles of those points and the position of interest. The minimum value will correspond to the distance between the generic point and the closest one on the coast.

This website describes how you can calculate the great circles.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.