Function to extract coordinates from a SpatialLines object.
If there are breaks in the line, this function connects the closest points to
create one line. Note: This differs from the function getCoords in
that the ordering of the points is considered.