libpysal.cg.Chain¶
- class libpysal.cg.Chain(vertices)[source]¶
Geometric representation of a chain, also known as a polyline.
Examples
>>> c = Chain([Point((0, 0)), Point((1, 0)), Point((1, 1)), Point((2, 1))])Create a chain from one ordered sequence of points or many parts.
Attributes
Returns the geometric length of the chain computed using 'arcdistance' (meters).
Returns the bounding box of the chain.
Returns the geometric length of the chain.
Returns the parts (lists of
libpysal.cg.Pointobjects) of the chain.Returns the segments that compose the chain.
Returns the vertices of the chain in clockwise order.
- property arclen : int | float[source]¶
Returns the geometric length of the chain computed using ‘arcdistance’ (meters).
- property bounding_box[source]¶
Returns the bounding box of the chain.
Examples
>>> c = Chain([Point((0, 0)), Point((2, 0)), Point((2, 1)), Point((0, 1))]) >>> c.bounding_box.left 0.0>>> c.bounding_box.lower 0.0>>> c.bounding_box.right 2.0>>> c.bounding_box.upper 1.0
- property len : int[source]¶
Returns the geometric length of the chain.
Examples
>>> c = Chain([Point((0, 0)), Point((1, 0)), Point((1, 1)), Point((2, 1))]) >>> c.len 3.0>>> c = Chain( ... [ ... [Point((0, 0)), Point((1, 0)), Point((1, 1))], ... [Point((10, 10)), Point((11, 10)), Point((11, 11))] ... ] ... ) >>> c.len 4.0