title: calculating minimum distance between a point and the coast
body: <p>I am trying to get the minimum distance between a given point and the coast. My example is the distance of Madrid to the coast:</p>
  
  <pre><code>library(rgeos)
  library(maptools)
  coast &lt;- readShapeLines("Natural_Earth_quick_start/10m_physical/ne_10m_coastline.shp")
  MAD = readWKT("POINT(-3.716667 40.383333)")
  gDistance(MAD,coast)
  [1] 3.021808
  </code></pre>
  
  <p>I am having trouble understanding what <code>gDistance()</code> returns. The docs say it's in the units of the projection. Does that mean it is in latlong degrees? How can I convert that to kilometers?</p>