LineStrings
===========

Initialization
--------------

  >>> from shapely.geometry import LineString

Construct from a numpy array

  >>> from numpy import array
  >>> line = LineString(array([[0.0, 0.0], [1.0, 2.0]]))
  >>> len(line.coords)
  2
  >>> line.wkt
  'LINESTRING (0.0000000000000000 0.0000000000000000, 1.0000000000000000 2.0000000000000000)'

From coordinate tuples

  >>> line = LineString(((1.0, 2.0), (3.0, 4.0)))
  >>> len(line.coords)
  2
  >>> line.wkt
  'LINESTRING (1.0000000000000000 2.0000000000000000, 3.0000000000000000 4.0000000000000000)'


Numpy Support
-------------

  >>> from numpy import asarray
  >>> la = asarray(line)
  >>> la
  array([[ 1.,  2.],
         [ 3.,  4.]])
  >>> la[0]
  array([ 1.,  2.])

Bounds
------

  >>> line.bounds
  (1.0, 2.0, 3.0, 4.0)

Coordinate Access
-----------------

  >>> tuple(line.coords)
  ((1.0, 2.0), (3.0, 4.0))

  >>> line.coords[0]
  (1.0, 2.0)
  >>> line.coords[1]
  (3.0, 4.0)
  >>> line.coords[2]
  Traceback (most recent call last):
  ...
  IndexError: index out of range

Geo interface
-------------

  >>> line.__geo_interface__
  {'type': 'LineString', 'coordinates': ((1.0, 2.0), (3.0, 4.0))}


Coordinate modification
-----------------------

  >>> line.coords = ((-1.0, -1.0), (1.0, 1.0))
  >>> line.__geo_interface__
  {'type': 'LineString', 'coordinates': ((-1.0, -1.0), (1.0, 1.0))}


Adapter
-------

  >>> from shapely.geometry import asLineString

  Adapt a Numpy array to a line string

  >>> a = array([[1.0, 2.0], [3.0, 4.0]])
  >>> la = asLineString(a)
  >>> la.context
  array([[ 1.,  2.],
         [ 3.,  4.]])

  >>> la.wkt
  'LINESTRING (1.0000000000000000 2.0000000000000000, 3.0000000000000000 4.0000000000000000)'

  Now, the inverse

  >>> la.__array_interface__ == la.context.__array_interface__
  True
  >>> as = asarray(la)
  >>> as
  array([[ 1.,  2.],
         [ 3.,  4.]])

  Adapt a coordinate list to a line string

  >>> coords = [[5.0, 6.0], [7.0, 8.0]]
  >>> la = asLineString(coords)
  >>> la.wkt
  'LINESTRING (5.0000000000000000 6.0000000000000000, 7.0000000000000000 8.0000000000000000)'
  
