Skip to main content

Polygon

This class represents a polygon geometry consisting of an exterior shell and optional interior rings. It provides functionality to access individual rings by index, retrieve the exterior ring specifically, and calculate the total number of points across all rings. The class also supports exporting the geometry as a nested tuple of coordinates.

Attributes

AttributeTypeDescription
exterior_ring[OGRGeometry](ogrgeometry.md?sid=django_contrib_gis_gdal_geometries_ogrgeometry)Return the shell of this Polygon.
coordstupleReturn a tuple of LinearRing coordinate tuples.

Methods


shell()

@classmethod
def shell() - > [OGRGeometry](ogrgeometry.md?sid=django_contrib_gis_gdal_geometries_ogrgeometry)

Return the shell of this Polygon.

Returns

TypeDescription
[OGRGeometry](ogrgeometry.md?sid=django_contrib_gis_gdal_geometries_ogrgeometry)The exterior ring (shell) of the polygon, equivalent to the first ring index

tuple()

@classmethod
def tuple() - > tuple

Return a tuple of LinearRing coordinate tuples.

Returns

TypeDescription
tupleA nested tuple structure containing the coordinate sequences for every ring in the polygon

point_count()

@classmethod
def point_count() - > int

Return the number of Points in this Polygon.

Returns

TypeDescription
intThe aggregate sum of all points across all rings within the polygon