The LinearRing constructor takes an ordered sequence of (x, y[, z])
point tuples.
LinearRing构造函数接收一个有序序列(x, y[, z])的点元祖。
The sequence may be explicitly closed by passing identical values in the first and last indices. Otherwise, the sequence will be implicitly closed by copying the first tuple to the last index. As with a LineString, repeated points in the ordered sequence are allowed, but may incur performance penalties and should be avoided. A LinearRing may not cross itself, and may not touch itself at a single point.
传递的有序序列通过在第一个和最后一个点中传递相同的值来明确地闭合线环。否则,会将第一个点复制到最后一个点来隐式闭合线环。与LineString一样,允许有序序列中重复点,但可能会产生性能损失,应该避免。LinearRing不能与自己自相交,也不能在一个单点上接触。
下图a为有效线环,下图b为无效线环。
(Source code, png, hires.png, pdf)
Note :Shapely will not prevent the creation of such rings, but exceptions will be raised when they are operated on. Shapely不会阻止这种环的创建,但是当它们被操作时,可能会出现异常。
A LinearRing has zero area and non-zero length.
一个LinearRing的面积为零,长度不为零。
>>> from shapely import LinearRing
>>> ring = LinearRing([(0, 0), (1, 1), (1, 0)])
>>> ring.area
0.0
>>> ring.length
3.414213562373095
Its x-y bounding box is a (minx, miny, maxx, maxy)
tuple.
它的边界是一个元组(minx, miny, maxx, maxy)。
>>> ring.bounds
(0.0, 0.0, 1.0, 1.0)
Defining coordinate values are accessed via the coords property.
定义坐标值可以通过coords属性访问的。
>>> len(ring.coords)
4
>>> list(ring.coords)
[(0.0, 0.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0)]
The LinearRing constructor also accepts another LineString or LinearRing instance, thereby making a copy.
LinearRing构造函数也接收另一个LineString或LinearRing实例,从而得到一个副本。
>>> LinearRing(ring)
<LINEARRING (0 0, 1 1, 1 0, 0 0)>
As with LineString, a sequence of Point instances is not a valid constructor parameter.
与LineString一样,不能以Point实例序列作为构造函数的参数。