If have two points, from which I want to create a straight LineString object:
from shapely.geometry import Point, LineString
A = Point(0,0)
B = Point(1,1)
The Shapely manual for LineString states:
A sequence of
Pointinstances is not a valid constructor parameter. ALineStringis described by points, but is not composed of Point instances.
So if I have two points A and B, is there a shorter/better/easier way of creating a line AB than my current "best" guess...
AB = LineString(tuple(A.coords) + tuple(B.coords))
... which looks rather complicated. Is there an easier way?
With Shapely 1.3.2, the above statement from the manual is no longer correct. So from now on,
AB = LineString([A, B])
works!
shapely.__version__agrees) and pasting your code verbatim, I receive a ValueError from linestring.pyc#228 about "Input[<...Point object at 0x..>, <...Point object at 0x...>]is the wrong shape for a LineString". Have I missed something? – ojdo May 13 '14 at 11:12