Help on class Polygon in module shapely.geometry.polygon:
class Polygon(shapely.geometry.base.BaseGeometry)
| Polygon(shell=None, holes=None)
|
| A two-dimensional figure bounded by a linear ring
|
| A polygon 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.
|
| Attributes
| ----------
| exterior : LinearRing
| The ring which bounds the positive space of the polygon.
| interiors : sequence
| A sequence of rings which bound all existing holes.
|
| Method resolution order:
| Polygon
| shapely.geometry.base.BaseGeometry
| builtins.object
|
| Methods defined here:
|
| __eq__(self, other)
| Return self==value.
|
| __init__(self, shell=None, holes=None)
| Parameters
| ----------
| shell : sequence
| A sequence of (x, y [,z]) numeric coordinate pairs or triples
| holes : sequence
| A sequence of objects which satisfy the same requirements as the
| shell parameters above
|
| Example
| -------
| Create a square polygon with no holes
|
| >>> coords = ((0., 0.), (0., 1.), (1., 1.), (1., 0.), (0., 0.))
| >>> polygon = Polygon(coords)
| >>> polygon.area
| 1.0
|
| __ne__(self, other)
| Return self!=value.
|
| svg(self, scale_factor=1.0, fill_color=None)
| Returns SVG path element for the Polygon geometry.
|
| Parameters
| ==========
| scale_factor : float
| Multiplication factor for the SVG stroke-width. Default is 1.
| fill_color : str, optional
| Hex string for fill color. Default is to use "#66cc99" if
| geometry is valid, and "#ff3333" if invalid.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bounds(xmin, ymin, xmax, ymax) from builtins.type
| Construct a `Polygon()` from spatial bounds.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __array_interface__
| Provide the Numpy array protocol.
|
| __geo_interface__
| Dictionary representation of the geometry
|
| coords
| Access to geometry's coordinates (CoordinateSequence)
|
| ctypes
| Return ctypes buffer
|
| exterior
|
| interiors
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from shapely.geometry.base.BaseGeometry:
|
| __and__(self, other)
|
| __del__(self)
|
| __or__(self, other)
|
| __reduce__(self)
| Helper for pickle.
|
| __setstate__(self, state)
|
| __str__(self)
| Return str(self).
|
| __sub__(self, other)
|
| __xor__(self, other)
|
| almost_equals(self, other, decimal=6)
| Returns True if geometries are equal at all coordinates to a
| specified decimal place
|
| Refers to approximate coordinate equality, which requires coordinates be
| approximately equal and in the same order for all components of a geometry.
|
| buffer(self, distance, resolution=16, quadsegs=None, cap_style=1, join_style=1, mitre_limit=5.0)
| Returns a geometry with an envelope at a distance from the object's
| envelope
|
| A negative distance has a "shrink" effect. A zero distance may be used
| to "tidy" a polygon. The resolution of the buffer around each vertex of
| the object increases by increasing the resolution keyword parameter
| or second positional parameter. Note: the use of a `quadsegs` parameter
| is deprecated and will be gone from the next major release.
|
| The styles of caps are: CAP_STYLE.round (1), CAP_STYLE.flat (2), and
| CAP_STYLE.square (3).
|
| The styles of joins between offset segments are: JOIN_STYLE.round (1),
| JOIN_STYLE.mitre (2), and JOIN_STYLE.bevel (3).
|
| The mitre limit ratio is used for very sharp corners. The mitre ratio
| is the ratio of the distance from the corner to the end of the mitred
| offset corner. When two line segments meet at a sharp angle, a miter
| join will extend the original geometry. To prevent unreasonable
| geometry, the mitre limit allows controlling the maximum length of the
| join corner. Corners with a ratio which exceed the limit will be
| beveled.
|
| Example:
|
| >>> from shapely.wkt import loads
| >>> g = loads('POINT (0.0 0.0)')
| >>> g.buffer(1.0).area # 16-gon approx of a unit radius circle
| 3.1365484905459389
| >>> g.buffer(1.0, 128).area # 128-gon approximation
| 3.1415138011443009
| >>> g.buffer(1.0, 3).area # triangle approximation
| 3.0
| >>> list(g.buffer(1.0, cap_style='square').exterior.coords)
| [(1.0, 1.0), (1.0, -1.0), (-1.0, -1.0), (-1.0, 1.0), (1.0, 1.0)]
| >>> g.buffer(1.0, cap_style='square').area
| 4.0
|
| contains(self, other)
| Returns True if the geometry contains the other, else False
|
| covers(self, other)
| Returns True if the geometry covers the other, else False
|
| crosses(self, other)
| Returns True if the geometries cross, else False
|
| difference(self, other)
| Returns the difference of the geometries
|
| disjoint(self, other)
| Returns True if geometries are disjoint, else False
|
| distance(self, other)
| Unitless distance to other geometry (float)
|
| empty(self, val=140590495520064)
|
| equals(self, other)
| Returns True if geometries are equal, else False
|
| Refers to point-set equality (or topological equality), and is equivalent to
| (self.within(other) & self.contains(other))
|
| equals_exact(self, other, tolerance)
| Returns True if geometries are equal to within a specified
| tolerance
|
| Refers to coordinate equality, which requires coordinates to be equal
| and in the same order for all components of a geometry
|
| geometryType(self)
|
| hausdorff_distance(self, other)
| Unitless hausdorff distance to other geometry (float)
|
| interpolate(self, distance, normalized=False)
| Return a point at the specified distance along a linear geometry
|
| If the normalized arg is True, the distance will be interpreted as a
| fraction of the geometry's length.
|
| intersection(self, other)
| Returns the intersection of the geometries
|
| intersects(self, other)
| Returns True if geometries intersect, else False
|
| overlaps(self, other)
| Returns True if geometries overlap, else False
|
| project(self, other, normalized=False)
| Returns the distance along this geometry to a point nearest the
| specified point
|
| If the normalized arg is True, return the distance normalized to the
| length of the linear geometry.
|
| relate(self, other)
| Returns the DE-9IM intersection matrix for the two geometries
| (string)
|
| relate_pattern(self, other, pattern)
| Returns True if the DE-9IM string code for the relationship between
| the geometries satisfies the pattern, else False
|
| representative_point(self)
| Returns a point guaranteed to be within the object, cheaply.
|
| simplify(self, tolerance, preserve_topology=True)
| Returns a simplified geometry produced by the Douglas-Peucker
| algorithm
|
| Coordinates of the simplified geometry will be no more than the
| tolerance distance from the original. Unless the topology preserving
| option is used, the algorithm may produce self-intersecting or
| otherwise invalid geometries.
|
| symmetric_difference(self, other)
| Returns the symmetric difference of the geometries
| (Shapely geometry)
|
| to_wkb(self)
|
| to_wkt(self)
|
| touches(self, other)
| Returns True if geometries touch, else False
|
| union(self, other)
| Returns the union of the geometries (Shapely geometry)
|
| within(self, other)
| Returns True if geometry is within the other, else False
|
| ----------------------------------------------------------------------
| Data descriptors inherited from shapely.geometry.base.BaseGeometry:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| area
| Unitless area of the geometry (float)
|
| array_interface_base
|
| boundary
| Returns a lower dimension geometry that bounds the object
|
| The boundary of a polygon is a line, the boundary of a line is a
| collection of points. The boundary of a point is an empty (null)
| collection.
|
| bounds
| Returns minimum bounding region (minx, miny, maxx, maxy)
|
| centroid
| Returns the geometric center of the object
|
| convex_hull
| Imagine an elastic band stretched around the geometry: that's a
| convex hull, more or less
|
| The convex hull of a three member multipoint, for example, is a
| triangular polygon.
|
| envelope
| A figure that envelopes the geometry
|
| geom_type
| Name of the geometry's type, such as 'Point'
|
| has_z
| True if the geometry's coordinate sequence(s) have z values (are
| 3-dimensional)
|
| is_closed
| True if the geometry is closed, else False
|
| Applicable only to 1-D geometries.
|
| is_empty
| True if the set of points in this geometry is empty, else False
|
| is_ring
| True if the geometry is a closed ring, else False
|
| is_simple
| True if the geometry is simple, meaning that any self-intersections
| are only at boundary points, else False
|
| is_valid
| True if the geometry is valid (definition depends on sub-class),
| else False
|
| length
| Unitless length of the geometry (float)
|
| minimum_rotated_rectangle
| Returns the general minimum bounding rectangle of
| the geometry. Can possibly be rotated. If the convex hull
| of the object is a degenerate (line or point) this same degenerate
| is returned.
|
| type
|
| wkb
| WKB representation of the geometry
|
| wkb_hex
| WKB hex representation of the geometry
|
| wkt
| WKT representation of the geometry
|
| xy
| Separate arrays of X and Y coordinate values
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from shapely.geometry.base.BaseGeometry:
|
| __geom__ = 140590495520064
|
| __p__ = None
|
| impl = <GEOSImpl object: GEOS C API version (1, 8, 0)>