Polygon#

class caf.cvt.functional_rules.Polygon(shell=None, holes=None)#

Bases: BaseGeometry

A geometry type representing an area that is enclosed by a linear ring.

A polygon is a two-dimensional feature and has a non-zero area. It may have one or more negative-space “holes” which are also bounded by linear rings. If any rings cross each other, the feature is invalid and operations on it may fail.

Parameters:
  • shell (sequence) – A sequence of (x, y [,z]) numeric coordinate pairs or triples, or an array-like with shape (N, 2) or (N, 3). Also can be a sequence of Point objects.

  • holes (sequence) – A sequence of objects which satisfy the same requirements as the shell parameters above

exterior#

The ring which bounds the positive space of the polygon.

Type:

LinearRing

interiors#

A sequence of rings which bound all existing holes.

Type:

sequence

Examples

Create a square polygon with no holes

>>> from shapely import Polygon
>>> coords = ((0., 0.), (0., 1.), (1., 1.), (1., 0.), (0., 0.))
>>> polygon = Polygon(coords)
>>> polygon.area
1.0

Attributes

coords

Not implemented for polygons.

exterior

Return the exterior ring of the polygon.

interiors

Return the sequence of interior rings of the polygon.

Methods

from_bounds(xmin, ymin, xmax, ymax)

Construct a Polygon() from spatial bounds.

svg([scale_factor, fill_color, opacity])

Return SVG path element for the Polygon geometry.

Attributes Documentation

coords#

Not implemented for polygons.

exterior#

Return the exterior ring of the polygon.

interiors#

Return the sequence of interior rings of the polygon.