pysal.lib.cg.Polygon

class pysal.lib.cg.Polygon(vertices, holes=None)[source]

Geometric representation of polygon objects.

Attributes:
vertices : list

Returns the vertices of the polygon in clockwise order.

len : int

Returns the number of vertices in the polygon.

perimeter : float

Returns the perimeter of the polygon.

bounding_box : Rectangle

Returns the bounding box of the polygon.

bbox : List

Returns the bounding box of the polygon as a list

area : float

Returns the area of the polygon.

centroid : tuple

Returns the centroid of the polygon

Methods

build_quad_tree_structure() Build the quad tree structure for this polygon.
contains_point(point) Test if polygon contains point
__init__(vertices, holes=None)[source]

Returns a polygon created from the objects specified.

__init__(Point list or list of Point lists, holes list ) -> Polygon

Parameters:
vertices : list – a list of vertices or a list of lists of vertices.
holes : list – a list of sub-polygons to be considered as holes.
is_quad_tree_structure_built

: bool – record if the quad tree structure has been built for this polygon. This quad tree structure could help speed up the contains_point test

Examples

>>> p1 = Polygon([Point((0, 0)), Point((1, 0)), Point((1, 1)), Point((0, 1))])

Methods

__init__(vertices[, holes]) Returns a polygon created from the objects specified.
build_quad_tree_structure() Build the quad tree structure for this polygon.
contains_point(point) Test if polygon contains point

Attributes

area Returns the area of the polygon.
bbox Returns the bounding box of the polygon as a list
bounding_box Returns the bounding box of the polygon.
centroid Returns the centroid of the polygon
holes Returns the holes of the polygon in clockwise order.
len Returns the number of vertices in the polygon.
parts Returns the parts of the polygon in clockwise order.
perimeter Returns the perimeter of the polygon.
vertices Returns the vertices of the polygon in clockwise order.