class MultiLineString(lines)
The MultiLineString constructor takes a sequence of line-like sequences or objects.
MultiLineString构造函数接收线性元祖序列或对象。
(Source code, png, hires.png, pdf)
A MultiLineString has zero area and non-zero length.
MultiLineString的面积为零,长度不为零。
>>> from shapely.geometry import MultiLineString
>>> coords = [((0, 0), (1, 1)), ((-1, 0), (1, 0))]
>>> lines = MultiLineString(coords)
>>> lines.area
0.0
>>> lines.length
3.4142135623730949
Its x-y bounding box is a (minx, miny, maxx, maxy)
tuple.
其边界是一个元组(minx, miny, maxx, maxy)。
>>> lines.bounds
(-1.0, 0.0, 1.0, 1.0)
Its members are instances of LineString and are accessed via the geoms
property or via the iterator protocol using in
or list()
.
其成员可以通过geoms属性或通过in、list()的迭代器协议来访问。
>>> len(lines.geoms)
2
>>> pprint.pprint(list(lines.geoms))
[<shapely.geometry.linestring.LineString object at 0x...>,
<shapely.geometry.linestring.LineString object at 0x...>]
>>> pprint.pprint(list(lines))
[<shapely.geometry.linestring.LineString object at 0x...>,
<shapely.geometry.linestring.LineString object at 0x...>]
The constructor also accepts another instance of MultiLineString or an unordered sequence of LineString instances, thereby making copies.
构造函数也接受另一个MultiLineString的实例或LineString实例的无序序列,从而得到一个副本。
>>> MultiLineString(lines)
<shapely.geometry.multilinestring.MultiLineString object at 0x...>
>>> MultiLineString(lines.geoms)
<shapely.geometry.multilinestring.MultiLineString object at 0x...>