title: Coordinates of the closest points of two geometries in Shapely
body: <p>There is a polyline with a list of coordinates of the vertices = [(x1,y1), (x2,y2), (x3,y3),...]  and a point(x,y). In Shapely, <code>geometry1.distance(geometry2)</code> returns the shortest distance between the two geometries. </p>
  
  <pre><code>&gt;&gt;&gt; from shapely.geometry import LineString, Point
  &gt;&gt;&gt; line = LineString([(0, 0), (5, 7), (12, 6)])  # geometry2
  &gt;&gt;&gt; list(line.coords)
  [(0.0, 0.0), (5.0, 7.0), (12.0, 6.0)]
  &gt;&gt;&gt; p = Point(4,8)  # geometry1
  &gt;&gt;&gt; list(p.coords)
  [(4.0, 8.0)]
  &gt;&gt;&gt; p.distance(line)
  1.4142135623730951
  </code></pre>
  
  <p>But I also need to find the coordinate of the point on the line that is closest to the point(x,y). In the example above, this is the coordinate of the point on the <code>LineString</code> object that is 1.4142135623730951 unit distant from <code>Point(4,8)</code>. The method <code>distance()</code> should have the coordinates when calculating the distance. Is there any way to get it returned from this method?</p>