Distance to nearest coast Sample This sample shows how to the approximate distance to the nearest coastline can be calculated from a point on the map. Click on the map and it attempt to calculate the nearest point on the coast. It does this by finding the nearest point on a set of country boundaries. Note that the accuracy of this relies heavily on the resolution of the country boundaries used. This sample is using lower resolution boundaries. The calculation is fairly intensive. If using higher resolution boundaries, it is recommended to do this calculation within a spatial database.